package com.badibadi.fragment;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import net.tsz.afinal.FinalBitmap;

import com.badibadi.activity.ActivityReadingActivity;
import com.badibadi.activity.AddApplyFormActivity;
import com.badibadi.activity.AfterLandingActivity;
import com.badibadi.activity.BaseActivity;
import com.badibadi.activity.CalendarClubActivityActivity;
import com.badibadi.activity.CalendarMyActivityActivity;
import com.badibadi.activity.ClubApplicationFormActivity;
import com.badibadi.activity.ClubDataGLYActivity;
import com.badibadi.activity.ClubDataHuiYuanActivity;
import com.badibadi.activity.ClubHomepageActivity;
import com.badibadi.activity.ClubMemberActivity;
import com.badibadi.activity.ClubMyClubActivity;
import com.badibadi.activity.ClubOtherSpaceActivity;
import com.badibadi.activity.ConsultingActivity;
import com.badibadi.activity.InformActivity;
import com.badibadi.activity.LogReadingActivity;
import com.badibadi.activity.LookAtTheDetailedActivity;
import com.badibadi.activity.MyDataActivity;
import com.badibadi.activity.MyOtherSpaceActivity;
import com.badibadi.activity.MyPoly1Activity;
import com.badibadi.activity.PicturePreviewActivity;
import com.badibadi.activity.PinyinChoiceTheTransferObjectActivity;
import com.badibadi.activity.PinyinSeeOtherPeopleFriendActivity;
import com.badibadi.activity.RecordListClubActivity;
import com.badibadi.activity.RecordMyRecordListActivity;
import com.badibadi.activity.SeeClubPolyActivity;
import com.badibadi.activity.SeeOtherPeoplePolyActivity;
import com.badibadi.activity.SeeOtherPeopleSpaceActivity;
import com.badibadi.activity.UpPicturesActivity;
import com.badibadi.adapter.GridViewSHUZHUAdapter;
import com.badibadi.fragment.AfterLandingMyHomePageMyFragment.ViewHolder;
import com.badibadi.fragment.AfterLandingMyHomePageOtherPeopleFragment.XListView1Adapter;
import com.badibadi.infos.BrowseAllPhoto_Model;
import com.badibadi.infos.ClubDataModel;
import com.badibadi.infos.ClubRoleModel;
import com.badibadi.infos.PersonalCenterHomePageModel;
import com.badibadi.infos.Results;
import com.badibadi.infos.User_trends_Model;
import com.badibadi.infos.infoUserModle;
import com.badibadi.mail.MailLianXiClubGLYActivity;
import com.badibadi.mail.MailSendAMassMailActivity;
import com.badibadi.mytools.BitmapHelp;
import com.badibadi.mytools.CalendarTools;
import com.badibadi.mytools.CommonUtils;
import com.badibadi.mytools.Constants;
import com.badibadi.mytools.Dialog;
import com.badibadi.mytools.HtmlUtils;
import com.badibadi.mytools.IOUtils;
import com.badibadi.mytools.JSONUtils;
import com.badibadi.mytools.MyThreadTool;
import com.badibadi.mytools.PopWindowUtils;
import com.badibadi.mytools.ShareSDKTools;
import com.badibadi.mytools.SinaExpressionTools;
import com.badibadi.mytools.Utils;
import com.badibadi.uniclubber.PinyinSeeClubMemberJCZYActivity;
import com.badibadi.uniclubber.R;
import com.hp.hpl.sparta.Text;
import com.libjph.util.StringUtil;
//import com.lidroid.xutils.util.LogUtils;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
import com.view.my_view.XListView;
import com.view.my_view.XListView.IXListViewListener;
import com.wyy.twodimcode.FinishListener;

import android.content.Context;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.support.v4.app.Fragment;
import android.text.TextUtils.TruncateAt;
import android.text.method.LinkMovementMethod;
import android.text.util.Linkify;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.GridView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.LinearLayout.LayoutParams;

//btn_zhuanrang；     ll_activity   ll_otherspace layoutId AddClub
/**
 * 
 * 
 * 俱乐部管理员 ,会员，未加入俱乐部的成员都可以用 传入参数3个 加入俱乐部 onCreateView layoutId
 * 
 * cid=getArguments().getString("cid"); //俱乐部id
 * admin_id=getArguments().getString("c_uid");//管理员id
 * is_join=getArguments().getString("is_join");//是否参加了该俱乐部0未参加，1.参加 delete_hands
 * 
 * @author Administrator layoutId ** (这是俱乐部管理员的) dianzan collect_operate
 * @author Administrator getView initTopViewId showTopView initRecordId
 *         RecordDongtai initClubId CreateClubDongtai initUpPictureId
 *         UpPictureDongtai initDongTaiId XinQingDongtai initActivityId
 *         PostActivityDongtai
 * 
 * 
 */
public class AfterLandingMyHomePageClubManangerFragment extends BaseFragment
		implements IXListViewListener {

	protected static final String TAG = "AfterLandingMyHomePageClubManangerFragment";
	/**
	 * 收藏标记
	 */
	private final int POST_COLLECT = 0;// collect
	/**
	 * 个人中心主页
	 */
	private final int POST_PERSONAL_CENTE_HOME_PAGE = 1;
	/**
	 * 初始化标记（用于判断发送什么方法）
	 */
	private int flags = POST_PERSONAL_CENTE_HOME_PAGE;

	/**
	 * 心情动态动态太长了的话默认显示130个字
	 */
	private int DongTaiZishu = 130;
	// Callback callback;//回调接口
	private String tag = "AfterLandingMyHomePageClubManangerFragment";
	private XListView1Adapter x1Adapter;
	private XListView xListView1;
	private int page = 0;
	private PersonalCenterHomePageModel personalCenterHomePageModel;
	private PersonalCenterHomePageModel personalCenterHomePageModel2;// 只有第一保存一次
	private String uid;
	private String fid = "-1";
	private DisplayImageOptions options;
	private FinalBitmap finalBitmap;
	private ClubDataModel dataModel;// 数据存放处
	// 数据存放处
	private List<User_trends_Model> user_trends;

	private List<User_trends_Model> list;
	private final int LAYOUT_CLUB = 0;
	private final int LAYOUT_ACTIVITY = 1;
	private final int LAYOUT_UPPICTURE = 2;
	private final int LAYOUT_DONGTAI = 3;
	private final int LAYOUT_RECORD = 4;
	// 点赞成功和失败
	private final int zanSuccess = 5;
	private final int zanShibai = 6;
	// 用于点赞后
	private View change_view;// 接受view的

	private String ShareImage = null; // 分享的图片
	private PopupWindow pop;

	/**
	 * 俱乐部主页----post
	 * 
	 * @param $cid
	 *            //俱乐部ID---11
	 * @param $uid
	 *            //访客用户的ID----1(管理员) 8（该俱乐部普通会员） 26（未加入该俱乐部用户）
	 * @param $type
	 *            ;//查看类型（1:管理员，2：该俱乐部普通会员，3：未加入该俱乐部用户）
	 * @param $languageType
	 *            ;//name为中文简体，tw_name 中文繁体 en_name 英文
	 * @param $page
	 *            ;//第几页
	 * @param $pageNum
	 *            ;//每页显示条数
	 */
	private String cid = "11";
	private String club_uid = "1";// 访客用户的ID 测试用 1(管理员) 8（该俱乐部普通会员）
									// 26（未加入该俱乐部用户）
	private String club_type = "1";// 查看种类
	/**
	 * 从activity中传过来的参数 cid //俱乐部id cid; 创建者id c_uid; 这里的创建者id就是管理员的id
	 * 当前访问者是否加入该俱乐部 String 0未加入 1加入 is_join;
	 * 
	 * @author Administrator
	 * 
	 */
	private String admin_id;// 管理员id
	private String is_join;// 判断访客是否加入了该俱乐部

	private int pageNum = 4;
	private Results resultsdd;

	// 记录收藏项
	private int pos_ = -1;
	private int delete_where_dongtai = -1;// 判断删除的是哪一条动态
	// 俱乐部的权限
	ClubRoleModel clubRoleModel;
	private Handler handler = new Handler() {
		@Override
		public void handleMessage(Message msg) {

			try {

				switch (msg.what) {
				case 1:

					try {
						Utils.ExitPrgress(getActivity());
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.l_net_error));
						xListView1.stopRefresh();
						xListView1.stopLoadMore();
						xListView1.setRefreshTime(""
								+ getResources().getString(R.string.ganggang));
					} catch (Exception e) {

					}

					break;
				case 2:
					try {
						Utils.ExitPrgress(getActivity());
						if (flags == POST_PERSONAL_CENTE_HOME_PAGE) {
							if (personalCenterHomePageModel != null
									&& personalCenterHomePageModel
											.getUser_trends() != null)
								user_trends.addAll(personalCenterHomePageModel
										.getUser_trends());
						} else if (flags == POST_COLLECT) {
							// user_trends.addAll(list);
							if (personalCenterHomePageModel != null
									&& personalCenterHomePageModel
											.getUser_trends() != null)
								user_trends.addAll(personalCenterHomePageModel
										.getUser_trends());
						}
						xListView1.stopRefresh();
						xListView1.stopLoadMore();
						xListView1.setRefreshTime(""
								+ getResources().getString(R.string.ganggang));
						x1Adapter.notifyDataSetChanged();
					} catch (Exception e) {
						// TODO: handle exception
					}

					break;
				case 3:
					try {
						Utils.ExitPrgress(getActivity());
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.l_xa10));
						xListView1.stopRefresh();
						xListView1.stopLoadMore();
						xListView1.setRefreshTime(""
								+ getResources().getString(R.string.ganggang));
					} catch (Exception e) {

					}

					break;
				case 5:// 点赞成功

					try {
						Utils.ExitPrgress(getActivity());
						int position = msg.getData().getInt("pos");
						// change_view.setSelected(true);
						user_trends.get(position).setIs_praise("1");
						user_trends.get(position).setAdmire(
								""
										+ (Integer.parseInt(user_trends.get(
												position).getAdmire()) + 1));
						x1Adapter.notifyDataSetChanged();

						// change_text.setText(""
						// + user_trends.get(position).getAdmire());
						// change_imageView.setSelected(true);
					} catch (Exception e) {
						// TODO: handle exception
					}

					break;
				case 6:// 点赞失败

					try {
						Utils.ExitPrgress(getActivity());
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.wx_zan_false));
					} catch (Exception e) {

					}
					break;
				case 7:
					try {
						Utils.ExitPrgress(getActivity());
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.l_net_error));
					} catch (Exception e) {

					}
					break;
				case 8:// 加入俱乐部
					try {
						Utils.ExitPrgress(getActivity());

						if (resultsdd.isRet() == true) {
							Utils.showMessage(getActivity(), getResources()
									.getString(R.string.wx_add_success));
							Intent intent = new Intent(getActivity(),
									ClubHomepageActivity.class);
							intent.putExtra("cid", cid);
							startActivity(intent);
							getActivity().overridePendingTransition(
									R.anim.slide_left, R.anim.slide_right);
							getActivity().finish();
						} else {
							try {
								Utils.ExitPrgress(getActivity());
								Utils.showMessage(getActivity(), getResources()
										.getString(R.string.wx_txt_51));
							} catch (Exception e) {

							}
						}

					} catch (Exception e) {
						// TODO: handle exception
					}
					break;
				case 9:
					try {
						Utils.ExitPrgress(getActivity());
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.l_xa10));
					} catch (Exception e) {

					}
					break;
				case 10:
					try {
						Add_club("1", msg.getData().getString("result"));
					} catch (Exception e) {
						// TODO: handle exception
					}

					break;

				case 11:// 收藏成功

					try {
						Utils.ExitPrgress(getActivity());
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.wx_shoucang_success));
						if (pos_ != -1) {
							user_trends.get(pos_).setIs_collected(1);
							user_trends
									.get(pos_)
									.setCollect(
											""
													+ (Integer
															.parseInt((user_trends
																	.get(pos_)
																	.getCollect())) + 1));
							x1Adapter.notifyDataSetChanged();

						}
					} catch (Exception e) {

					}
					break;
				case 12://

					try {
						Utils.ExitPrgress(getActivity());
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.wx_shoucang_false));
					} catch (Exception e) {

					}
					break;
				case 13:// 删除动态成功

					try {
						Utils.ExitPrgress(getActivity());
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.wx_delete_success));
						// ((AfterLandingActivity) (getActivity())).jiazai(9);
						// delete_where_dongtai
						user_trends.remove(delete_where_dongtai);
						x1Adapter.notifyDataSetInvalidated();
					} catch (Exception e) {

					}
					break;
				case 14:// 删除动态失败

					try {
						Utils.ExitPrgress(getActivity());
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.wx_delete_false));
					} catch (Exception e) {

					}
					break;
				case 15:// 验证身份

					try {
						Utils.ExitPrgress(getActivity());
						// Utils.showMessage(getActivity(), "");
						if (clubRoleModel.getIsVisit().equals("0")) {
							Utils.showMessage(getActivity(), getResources()
									.getString(R.string.wx_txt_52));
							if (clubRoleModel.getRole().equals("2")) {
								club_type = "1";
							} else if (clubRoleModel.getRole().equals("1")) {
								club_type = "2";
							} else if (clubRoleModel.getRole().equals("0")) {
								club_type = "3";
							}
							xListView1.startLoadMore();
							// getActivity().finish();
							// is_join
						} else {
							if (clubRoleModel.getRole().equals("0")) {
								is_join = "0";
							} else {
								is_join = "1";
							}
							// （1:管理员，2：该俱乐部普通会员，3：未加入该俱乐部用户）
							// if (uid.equals(admin_id)) {
							// club_type = "1";
							// } else if (is_join.equals("1"))// 是否加入了该俱乐部
							// {
							// club_type = "2";
							// } else {
							// club_type = "3";
							// }
							if (clubRoleModel.getRole().equals("2")) {
								club_type = "1";
							} else if (clubRoleModel.getRole().equals("1")) {
								club_type = "2";
							} else if (clubRoleModel.getRole().equals("0")) {
								club_type = "3";
							}
							xListView1.startLoadMore();
						}

					} catch (Exception e) {

					}
					break;

				case 16:// 网络连接失败

					try {
						Utils.ExitPrgress(getActivity());
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.l_net_error));
					} catch (Exception e) {

					}

					break;
				default:
					break;
				}
			} catch (Exception e) {

			}
		}
	};

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		uid = Utils.getUid(getActivity());
		club_uid = Utils.getUid(getActivity());

		cid = getArguments().getString("cid");

		// admin_id = getArguments().getString("c_uid");
		// is_join = getArguments().getString("is_join");
		//
		// // 判断我是不是俱乐部管理员
		// try {
		// if (uid.equals(admin_id)) {
		// club_type = "1";
		// } else if (is_join.equals("1"))// 是否加入了该俱乐部
		// {
		// club_type = "2";
		// } else {
		// club_type = "3";
		// }
		// } catch (Exception e) {
		// // TODO: handle exception
		// }

		// clubRole(cid);
		// /**
		// * 俱乐部主页----post
		// * @param $cid //俱乐部ID---11
		// * @param $uid //访客用户的ID----1(管理员) 8（该俱乐部普通会员） 26（未加入该俱乐部用户）
		// * @param $type;//查看类型（1:管理员，2：该俱乐部普通会员，3：未加入该俱乐部用户）
		// * @param $languageType ;//name为中文简体，tw_name 中文繁体 en_name 英文
		// * @param $page;//第几页
		// * @param $pageNum;//每页显示条数
		// */
		// private String cid="11";
		// private String club_uid="1";//访客用户的ID----1(管理员) 8（该俱乐部普通会员）
		// 26（未加入该俱乐部用户）
		// private String club_type="1";

		finalBitmap = FinalBitmap.create(getActivity());
		finalBitmap.configLoadfailImage(R.drawable.noimage);
		finalBitmap.configLoadingImage(R.drawable.noimage);
		// finalBitmap.configLoadingImage(R)
		user_trends = new ArrayList<User_trends_Model>();
		user_trends.add(new User_trends_Model());
		// personalCenterHomePageModel=new PersonalCenterHomePageModel();
		// initMessage();
		options = new DisplayImageOptions.Builder()
				.showStubImage(R.drawable.ic_stub)
				.showImageForEmptyUri(R.drawable.noimage)
				.showImageOnFail(R.drawable.noimage).cacheInMemory()
				.cacheOnDisc().displayer(new RoundedBitmapDisplayer(5)).build();
		// (PersonalCenterHomePageModel)
		// getArguments().getSerializable("afterLandingMyHomePageMyFragment");
		personalCenterHomePageModel = new PersonalCenterHomePageModel();
		// initData();

		//
	}

	@Override
	public void onStart() {
		// TODO Auto-generated method stub
		super.onStart();
		Constants.Send_Apply_handler = handler;
		abum(cid);
	}

	// 改

	@Override
	public void onDestroy() {
		super.onDestroy();
		ImageLoader.getInstance().clearDiscCache();
		ImageLoader.getInstance().clearMemoryCache();
		System.out.println("club" + "onDestroy()清理");
	}

	@Override
	public void onPause() {
		super.onPause();
		ImageLoader.getInstance().clearDiscCache();
		ImageLoader.getInstance().clearMemoryCache();
		System.out.println("club" + "onPause()清理");

	}

	/*
	 * @Override public void onDetach() { System.out.println("惠");
	 * super.onDetach(); }
	 */

	/**
	 * 初始化listView
	 */
	private void initData() {
		if (personalCenterHomePageModel != null) {
			if (personalCenterHomePageModel.getUser_trends() != null) {
				// user_trends=personalCenterHomePageModel.getUser_trends();
				// for(int i=0;i<user_trends.size();i++)
				// {
				//
				//
				// }
			}

		}

	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = inflater.inflate(R.layout.xlistview, null);
		clubRole(cid);
		InitMyXListView1(view);

		// mListView.setPullLoadEnable(true);

		// mListView.setAdapter(x1Adapter);
		return view;
	}

	/**
	 * S 判断登录用户在访问的俱乐部中的角色，并且判断该冯轲是否有权限访问该俱乐部---POST
	 * 
	 * @param $uid
	 *            登录用户ID
	 * @param $cid
	 *            被访问的俱乐部ID
	 */
	private void clubRole(final String cid) {
		// TODO Auto-generated method stub
		Utils.showPrgress(getActivity());
		MyThreadTool.fixedThreadPool.execute(new Runnable() {
			@Override
			public void run() {
				Map<String, Object> map = new HashMap<String, Object>();
				map.put("uid", Utils.getUid(getActivity()));
				map.put("cid", cid);

				String content = Utils.sendRequest(map, Constants.BadiUrl_1
						+ "commonality/clubRole");
				if (content != null) {
					resultsdd = Utils.checkResult_NNN(getActivity(), content);
					// ("角色的参数是:" + content + " "
					// + resultsdd.getRetmsg());
					//
					if (resultsdd != null
							&& !resultsdd.getRetmsg().equals("null")) {
						try {
							clubRoleModel = JSONUtils.getEntityByJsonString(
									resultsdd.getRetmsg(), ClubRoleModel.class);

						} catch (Exception e) {

						}

						//
						// "角色的参数是:" + content + " "
						// + resultsdd.getRetmsg());
						if (resultsdd.isRet() == true) {
							handler.sendEmptyMessage(15);
						} else {
							handler.sendEmptyMessage(16);
						}
					} else {
						handler.sendEmptyMessage(7);
					}
				} else {
					handler.sendEmptyMessage(7);
				}
			}
		});
	}

	public void InitMyXListView1(View view) {
		xListView1 = (XListView) view.findViewById(R.id.my_xListView1);
		xListView1
				.setXListViewListener(AfterLandingMyHomePageClubManangerFragment.this);
		xListView1.setPullLoadEnable(true);
		xListView1.setPullRefreshEnable(true);
		xListView1.setBackgroundColor(getResources().getColor(
				R.color.gray_eaeaea));
		xListView1.setDivider(null);
		x1Adapter = new XListView1Adapter();
		xListView1.setAdapter(x1Adapter);

	}

	class XListView1Adapter extends BaseAdapter {

		ViewHolder holder;
		int[] layoutId = new int[] { R.layout.chuangjianjulebudongtai,// 创建俱乐部ok
																		// logo
				R.layout.fahuodongdongtai,// 发起活动
				R.layout.up_tupiandongtai,// 上传图片
				R.layout.dongtaiaddtupian,// 动态（图片和文字都有）ok
				R.layout.jiludongtai // 记录动态
		};

		@Override
		public int getCount() {

			return user_trends.size();
		}

		@Override
		public int getItemViewType(int position) {

			//
			//
			//
			//
			try {
				if (position == 0) {
					// convertView = setMyHomePagePic(position, convertView,
					// parent);
					//
					// return convertView;
					return 5;
				} else if (!StringUtil.isNullOrEmpty(user_trends.get(position)
						.getType())
						&& user_trends.get(position).getType().equals("club")) {
					return 0;
				} else if (!StringUtil.isNullOrEmpty(user_trends.get(position)
						.getType())
						&& user_trends.get(position).getType()
								.equals("activity")) {
					return 1;
				} else if (!StringUtil.isNullOrEmpty(user_trends.get(position)
						.getType())
						&& user_trends.get(position).getType().equals("photo")) {
					return 2;
				} else
				// dongtaiaddtupian
				if (!StringUtil.isNullOrEmpty(user_trends.get(position)
						.getType())
						&& user_trends.get(position).getType()
								.equals("humor_trends"))// humor_trends
				{
					return 3;
				} else if (!StringUtil.isNullOrEmpty(user_trends.get(position)
						.getType())
						&& user_trends.get(position).getType().equals("record")) {
					return 4;
				}

			} catch (Exception e) {

			}

			return 1;

		}

		@Override
		public int getViewTypeCount() {

			return 7;
		}

		@Override
		public Object getItem(int position) {

			if (position != 0)
				return user_trends.get(position);
			else {
				return null;
			}
		}

		@Override
		public long getItemId(int position) {

			return (position);
		}

		@Override
		public View getView(int position, View convertView, ViewGroup parent) {

			// ///////////////////////////////////////////////这个view是看别人空间的

			holder = new ViewHolder();
			LayoutInflater inflater = LayoutInflater.from(getActivity());
			//
			int type = getItemViewType(position);

			if (convertView == null) {

				switch (type) {
				case LAYOUT_CLUB:
					convertView = inflater.inflate(layoutId[0], null);
					initClubId(convertView, holder);
					break;
				case LAYOUT_ACTIVITY:
					convertView = inflater.inflate(layoutId[1], null);
					initActivityId(convertView, holder);
					break;
				case LAYOUT_UPPICTURE:
					convertView = inflater.inflate(layoutId[2], null);
					initUpPictureId(convertView, holder);
					break;
				case LAYOUT_DONGTAI:
					convertView = inflater.inflate(layoutId[3], null);
					initDongTaiId(convertView, holder);
					break;
				case LAYOUT_RECORD:
					convertView = inflater.inflate(layoutId[4], null);
					initRecordId(convertView, holder);
					break;
				case 5:// 头部

					convertView = inflater
							.inflate(R.layout.club_mananger, null);
					initTopViewId(convertView, holder);
					break;
				// return convertView;
				}
				convertView.setTag(holder);
			} else {
				holder = (ViewHolder) convertView.getTag();
			}

			if (clubRoleModel != null) {

				try {
					//
					if (!clubRoleModel.getIsVisit().equals("0")) {
						int t = getItemViewType(position);
						showdongtai(convertView, holder, position, t);
					}
				} catch (Exception e) {
					// TODO: handle exception

				}

				// 这是顶部视图
				if (getItemViewType(position) == 5) {
					showTopView(holder);
				}

				/**
				 * R.layout.chuangjianjulebudongtai,//创建俱乐部
				 * R.layout.fahuodongdongtai,//发起活动
				 * R.layout.up_tupiandongtai,//上传图片
				 * R.layout.dongtaiaddtupian,//动态（图片和文字都有）
				 * R.layout.jiludongtai//记录动态 //
				 */

			}
			return convertView;
		}

		/**
		 * 动态
		 * 
		 * @param convertView
		 */
		private void showdongtai(View convertView, ViewHolder holder, int pos,
				int type) {

			/**
			 * 创建俱乐部动态
			 */
			if (type == LAYOUT_CLUB) {

				CreateClubDongtai(convertView, holder, pos);

			}
			/**
			 * 发起活动
			 */
			if (type == LAYOUT_ACTIVITY) {
				// try {
				PostActivityDongtai(convertView, holder, pos);
				// } catch (Exception e) {
				//
				// }
			}
			/**
			 * 上传图片
			 */
			if (type == LAYOUT_UPPICTURE) {
				// try {
				UpPictureDongtai(convertView, holder, pos);
				// } catch (Exception e) {
				//
				// }
			}

			/**
			 * 动态（图片和文字都有）
			 * 
			 */
			if (type == LAYOUT_DONGTAI) {
				// 心情动态
				// try {
				XinQingDongtai(convertView, holder, pos);
				// } catch (Exception e) {
				//
				// }

			}
			/**
			 * 记录动态
			 */
			if (type == LAYOUT_RECORD) {
				// 记录动态
				// try {
				RecordDongtai(convertView, holder, pos);
				// } catch (Exception e) {
				//
				// }

			}
		}

		/**
		 * 初始化顶部视图id
		 * 
		 * @param convertView
		 * @param holder
		 */
		public void initTopViewId(View convertView, ViewHolder holder) {
			// 俱乐部主页底部蓝色标签
			holder.l_blue1 = (LinearLayout) convertView
					.findViewById(R.id.l_blue1);
			// 收藏底部蓝色标签
			holder.l_blue2 = (LinearLayout) convertView
					.findViewById(R.id.l_blue2);
			// 加载背景图
			holder.iv_beijing = (ImageView) convertView
					.findViewById(R.id.iv_beijing);

			holder.iv_touxiang = (ImageView) convertView
					.findViewById(R.id.iv_touxiang);
			// tv_motto 座右铭
			holder.tv_motto = (TextView) convertView
					.findViewById(R.id.tv_motto);

			// 昵称
			holder.tv_nickName = (TextView) convertView
					.findViewById(R.id.tv_nickName);

			// 城市
			holder.tv_city = (TextView) convertView.findViewById(R.id.tv_city);

			// // 图片
			// holder.t_picture = (TextView)
			// convertView.findViewById(R.id.t_pic);
			//
			// // 记录
			// holder.t_record = (TextView)
			// convertView.findViewById(R.id.t_record);
			//
			// // 俱乐部
			// holder.t_club = (TextView) convertView.findViewById(R.id.t_club);
			//
			// // 活动
			// holder.t_activity = (TextView) convertView
			// .findViewById(R.id.t_activity);
			//
			// // 朋友
			// holder.t_friends = (TextView)
			// convertView.findViewById(R.id.t_friends);
			// 图片数量
			holder.photoImgNum_text = (TextView) convertView
					.findViewById(R.id.photoImgNum);
			// 活动数量
			holder.activityNum_text = (TextView) convertView
					.findViewById(R.id.activityNum);
			// 记录数量
			holder.recordNum_text = (TextView) convertView
					.findViewById(R.id.recordNum);
			// 会员数量
			holder.addnum_text = (TextView) convertView
					.findViewById(R.id.addnum);
			holder.consult_text = (TextView) convertView
					.findViewById(R.id.consultnum);
			// 申请表数量
			holder.shenqingbiao_text = (TextView) convertView
					.findViewById(R.id.shenqingbiao_text);

			holder.one = (LinearLayout) convertView.findViewById(R.id.one);
			holder.one_line = (LinearLayout) convertView
					.findViewById(R.id.one_line);
			holder.two = (LinearLayout) convertView.findViewById(R.id.two);
			holder.two_line = (LinearLayout) convertView
					.findViewById(R.id.two_line);
			// 右箭头的
			holder.right = (ImageView) convertView.findViewById(R.id.right);

			holder.left = (ImageView) convertView.findViewById(R.id.left);
			// one
			holder.ll_home_page = (LinearLayout) convertView
					.findViewById(R.id.ll_home_page);// 个人主页
			holder.ll_picture = (LinearLayout) convertView
					.findViewById(R.id.ll_picture);
			holder.ll_record = (LinearLayout) convertView
					.findViewById(R.id.ll_record);
			holder.ll_consult = (LinearLayout) convertView
					.findViewById(R.id.ll_consult);
			holder.ll_activity = (LinearLayout) convertView
					.findViewById(R.id.ll_activity);

			// two收藏按钮
			holder.ll_members = (LinearLayout) convertView
					.findViewById(R.id.ll_members);
			holder.ll_collect = (LinearLayout) convertView
					.findViewById(R.id.ll_collect);
			holder.ll_shenqingbiao = (LinearLayout) convertView
					.findViewById(R.id.ll_shenqingbiao);
			holder.ll_data = (LinearLayout) convertView
					.findViewById(R.id.ll_data);
			// holder.ll_otherspace = (LinearLayout) convertView
			// .findViewById(R.id.ll_otherSpace);

			holder.top_text_gongneng = (TextView) convertView
					.findViewById(R.id.top_text_gongneng);
			holder.top_text_mail = (TextView) convertView
					.findViewById(R.id.top_text_mail);
			holder.top_gongnengpic = (ImageView) convertView
					.findViewById(R.id.top_gongnengpic);
			holder.btn_zhuanrang = (LinearLayout) convertView
					.findViewById(R.id.btn_zhuanrang);
			holder.btn_zhannei = (LinearLayout) convertView
					.findViewById(R.id.btn_zhannei);
			// 顶部视图
			// TextView top_text_gongneng,top_text_mail;//一个是功能按钮，一个是管理员的按钮
			// ImageView top_gongnengpic;//功能图
			// LinearLayout btn_zhuanrang,btn_zhannei;//一个是功能按钮，一个是管理员的按钮

			holder.videoimage = (ImageView) convertView
					.findViewById(R.id.videoimage);
			holder.videotitle = (TextView) convertView
					.findViewById(R.id.videotitle);
			holder.videoxianshi = (LinearLayout) convertView
					.findViewById(R.id.videoxianshi);

		}

		/**
		 * 显示顶部视图，自己的头像，背景等等
		 * 
		 * @param holder
		 */
		public void showTopView(final ViewHolder holder) {

			if (personalCenterHomePageModel2 != null) {
				// holder.top_text_gongneng = (TextView) convertView
				// .findViewById(R.id.top_text_gongneng);
				// holder.top_text_mail = (TextView) convertView
				// .findViewById(R.id.top_text_mail);
				// holder.top_gongnengpic = (ImageView) convertView
				// .findViewById(R.id.top_gongnengpic);
				// holder.btn_zhuanrang = (LinearLayout) convertView
				// .findViewById(R.id.btn_zhuanrang);
				// holder.btn_zhannei = (LinearLayout) convertView
				// .findViewById(R.id.btn_zhannei);
				// * @param $type
				// * ;//查看类型（1:管理员，2：该俱乐部普通会员，3：未加入该俱乐部用户）
				// 初始化显示
				if (club_type.equals("1")) {
					holder.top_text_gongneng.setText(getResources().getString(
							R.string.wx_zhuanrang));
					holder.top_text_mail.setText(getResources().getString(
							R.string.wx_qunfaxin));
					holder.top_gongnengpic
							.setBackgroundResource(R.drawable.zhuanrang);
					// 转让按钮
					holder.btn_zhuanrang
							.setOnClickListener(new View.OnClickListener() {

								@Override
								public void onClick(View v) {
									// TODO Auto-generated method stub
									// PinyinSeeClubMemberJCZYActivity
									// private String
									// flags="0";//;0是看俱乐部会员，1是转让俱乐部管理员//这只是界面的
									// private String cid="11";
									// private String type="2";// 1:俱乐部转让
									// 2：俱乐部会员总览列表//这是接口的
									// private String uid="1";
									// private String cj_uid="1";//俱乐部管理员的id

									if (!Utils.getUid(getActivity()).equals("")) {
										Intent intent = new Intent(
												getActivity(),
												PinyinSeeClubMemberJCZYActivity.class);
										intent.putExtra("flags", "1");
										intent.putExtra("cid", cid);
										intent.putExtra("cj_uid", admin_id);
										getActivity().startActivity(intent);
									} else {
										Toast.makeText(
												getActivity(),
												getResources().getString(
														R.string.l_xb10), 0)
												.show();
									}
								}
							});
					// 站内信
					holder.btn_zhannei
							.setOnClickListener(new View.OnClickListener() {

								@Override
								public void onClick(View v) {
									if (!Utils.getUid(getActivity()).equals("")) {
										Intent intent = new Intent(
												getActivity(),
												MailSendAMassMailActivity.class);
										intent.putExtra("admin_uid",
												Utils.getUid(getActivity()));
										intent.putExtra("cid", cid);

										//
										// ""
										// + personalCenterHomePageModel2
										// .getName());
										intent.putExtra("clubname",
												personalCenterHomePageModel2
														.getName());

										getActivity().startActivity(intent);
									} else {
										Toast.makeText(
												getActivity(),
												getResources().getString(
														R.string.l_xb10), 0)
												.show();
									}

								}
							});
				} else if (club_type.equals("2")) {
					holder.top_text_gongneng.setText(getResources().getString(
							R.string.l_xb30));
					holder.top_text_mail.setText(getResources().getString(
							R.string.wx_administrator));
					holder.top_gongnengpic
							.setBackgroundResource(R.drawable.gougou);
					// 转让按钮
					holder.btn_zhuanrang
							.setOnClickListener(new View.OnClickListener() {

								@Override
								public void onClick(View v) {
									if (!Utils.getUid(getActivity()).equals("")) {
										Intent intent = new Intent(
												getActivity(),
												PinyinSeeClubMemberJCZYActivity.class);
										intent.putExtra("flags", "0");
										intent.putExtra("cid", cid);
										intent.putExtra("cj_uid", admin_id);
										getActivity().startActivity(intent);
									} else {
										Toast.makeText(
												getActivity(),
												getResources().getString(
														R.string.l_xb10), 0)
												.show();
									}
								}
							});
					// 站内信
					holder.btn_zhannei
							.setOnClickListener(new View.OnClickListener() {

								@Override
								public void onClick(View v) {
									if (!Utils.getUid(getActivity()).equals("")) {
										Intent intent = new Intent(
												getActivity(),
												MailLianXiClubGLYActivity.class);
										// cid=getIntent().getStringExtra("cid");
										// admin_uid=getIntent().getStringExtra("admin_uid");
										//
										// clubname=getIntent().getStringExtra("clubname");

										intent.putExtra("cid", cid);
										intent.putExtra("admin_uid", admin_id);
										intent.putExtra("clubname",
												personalCenterHomePageModel2
														.getName());
										getActivity().startActivity(intent);
									} else {
										Toast.makeText(
												getActivity(),
												getResources().getString(
														R.string.l_xb10), 0)
												.show();
									}
								}
							});
				} else if (club_type.equals("3")) {
					holder.top_text_gongneng.setText(getResources().getString(
							R.string.wx_add));
					holder.top_text_mail.setText(getResources().getString(
							R.string.wx_administrator));
					holder.top_gongnengpic
							.setBackgroundResource(R.drawable.join);

					// 转让按钮
					holder.btn_zhuanrang
							.setOnClickListener(new View.OnClickListener() {

								@Override
								public void onClick(View v) {
									// TODO Auto-generated method stub
									// ("是否需要提交申请表:"
									// + personalCenterHomePageModel2
									// .getIs_apply());
									settingJoinPopWindow();
								}

							});
					// if (!Utils.getUid(getActivity()).equals("")) {
					// if (personalCenterHomePageModel2
					// .getIs_person().equals("0")) {
					//
					// if (!StringUtil
					// .isNullOrEmpty(personalCenterHomePageModel2
					// .getIs_gold())) {
					// if (personalCenterHomePageModel2
					// .getIs_gold().equals(
					// "1")) {
					// if (Integer
					// .valueOf(personalCenterHomePageModel2
					// .getPrice()) <= Integer
					// .valueOf(personalCenterHomePageModel2
					// .getGold())) {
					// if (personalCenterHomePageModel2
					// .getIs_apply()
					// .equals("0")) {
					// Add_club("0", "");
					// } else {
					// Intent intent = new Intent(
					// getActivity(),
					// AddApplyFormActivity.class);
					// intent.putExtra(
					// "pan",
					// "set");
					// intent.putExtra(
					// "cid", cid);
					// intent.putExtra(
					// "apply_id",
					// personalCenterHomePageModel2
					// .getApplyTableId());
					// startActivity(intent);
					// // Add_club("1",);
					// }
					// } else {
					// Utils.showMessage(
					// getActivity(),
					// getResources()
					// .getString(
					// R.string.wx_txt_111));
					// }
					// } else {
					// if (personalCenterHomePageModel2
					// .getIs_apply()
					// .equals("0")) {
					// Add_club("0", "");
					// } else {
					// Intent intent = new Intent(
					// getActivity(),
					// AddApplyFormActivity.class);
					// intent.putExtra("pan",
					// "set");
					// intent.putExtra("cid",
					// cid);
					// intent.putExtra(
					// "apply_id",
					// personalCenterHomePageModel2
					// .getApplyTableId());
					// startActivity(intent);
					// // Add_club("1",);
					// }
					// }
					//
					// }
					//
					// } else if (personalCenterHomePageModel2
					// .getIs_person().equals("1")) {
					// if (Integer
					// .valueOf(personalCenterHomePageModel2
					// .getAddnum()) >= Integer
					// .valueOf(personalCenterHomePageModel2
					// .getLimitnum())) {// 已达到人数限制
					// Utils.showMessage(
					// getActivity(),
					// getResources()
					// .getString(
					// R.string.wx_txt_110));
					// } else {// 没有达到人数限制
					// if (Integer
					// .valueOf(personalCenterHomePageModel2
					// .getPrice()) <= Integer
					// .valueOf(personalCenterHomePageModel2
					// .getGold())) {
					// if (personalCenterHomePageModel2
					// .getIs_apply()
					// .equals("0")) {
					// Add_club("0", "");
					// } else {
					// Intent intent = new Intent(
					// getActivity(),
					// AddApplyFormActivity.class);
					// intent.putExtra("pan",
					// "set");
					// intent.putExtra("cid",
					// cid);
					// intent.putExtra(
					// "apply_id",
					// personalCenterHomePageModel2
					// .getApplyTableId());
					// startActivity(intent);
					// // Add_club("1",);
					// }
					// } else {
					// Utils.showMessage(
					// getActivity(),
					// getResources()
					// .getString(
					// R.string.wx_txt_111));
					// }
					// }
					// }
					// } else {
					// Toast.makeText(
					// getActivity(),
					// getResources().getString(
					// R.string.l_xb10), 0)
					// .show();
					// }
					//
					// }
					// });
					// 站内信
					holder.btn_zhannei
							.setOnClickListener(new View.OnClickListener() {

								@Override
								public void onClick(View v) {
									if (!Utils.getUid(getActivity()).equals("")) {
										Intent intent = new Intent(
												getActivity(),
												MailLianXiClubGLYActivity.class);
										// cid=getIntent().getStringExtra("cid");
										// admin_uid=getIntent().getStringExtra("admin_uid");
										//
										// clubname=getIntent().getStringExtra("clubname");
										intent.putExtra("cid", cid);
										intent.putExtra("admin_uid", admin_id);
										intent.putExtra("clubname",
												personalCenterHomePageModel2
														.getName());
										getActivity().startActivity(intent);
									} else {
										Toast.makeText(
												getActivity(),
												getResources().getString(
														R.string.l_xb10), 0)
												.show();
									}
								}
							});
				}

				try {
					// 加载背景图
					// ImageLoader.getInstance().displayImage(
					// Constants.BadiDownImgUrl + "/"
					// + personalCenterHomePageModel2.getRoom_head()
					// + Constants.Appactivitycover,// getLogo(),
					// holder.iv_beijing, options);
					new BitmapHelp().displayImage(
							getActivity(),
							holder.iv_beijing,
							Constants.BadiDownImgUrl
									+ "/"
									+ personalCenterHomePageModel2
											.getRoom_head()
									+ Constants.Appactivitycover);
				} catch (Exception e) {

				}

				try {
					// 头像
					ImageLoader.getInstance().displayImage(
							Constants.BadiDownImgUrl + "/"
									+ personalCenterHomePageModel2.getLogo()
									+ Constants.App9block, holder.iv_touxiang,
							options);

					holder.iv_touxiang
							.setOnClickListener(new View.OnClickListener() {

								@Override
								public void onClick(View v) {
									// TODO Auto-generated method stub
									if (club_type.equals("1")) {
										Intent intent1 = new Intent(
												getActivity(),
												ClubDataGLYActivity.class);
										intent1.putExtra("cid", cid);
										getActivity().startActivity(intent1);
									} else if (club_type.equals("2")) {
										Intent intent = new Intent(
												getActivity(),
												ClubDataHuiYuanActivity.class);
										intent.putExtra("cid", cid);
										getActivity().startActivity(intent);
									} else {
										Toast.makeText(
												getActivity(),
												getResources().getString(
														R.string.wx_txt_53), 0)
												.show();
									}
								}
							});
				} catch (Exception e) {

				}

				// tv_motto 座右铭
				holder.tv_motto.setText(""
						+ personalCenterHomePageModel2.getInfo());
				// 昵称
				holder.tv_nickName.setText(""
						+ personalCenterHomePageModel2.getName());
				// 城市
				holder.tv_city.setText(""
						+ personalCenterHomePageModel2.getOriginate_address());

				holder.photoImgNum_text.setText(""
						+ personalCenterHomePageModel2.getPhotoImgNum());
				holder.activityNum_text.setText(""
						+ personalCenterHomePageModel2.getActivityNum());
				holder.addnum_text.setText(""
						+ personalCenterHomePageModel2.getAddnum());
				holder.consult_text.setText(""
						+ personalCenterHomePageModel2.getAddnum());
				holder.recordNum_text.setText(""
						+ personalCenterHomePageModel2.getRecordNum());
				if (personalCenterHomePageModel2.getFindCount() != null) {
					holder.shenqingbiao_text.setText(""
							+ personalCenterHomePageModel2.getFindCount());
				} else {
					holder.shenqingbiao_text.setText("");
				}

				// // 图片
				// holder.t_picture.setText(""
				// + personalCenterHomePageModel2.getPhoto());
				// // 记录
				// holder.t_record.setText(""
				// + personalCenterHomePageModel2.getTrends());
				// // 俱乐部
				// holder.t_club.setText("" +
				// personalCenterHomePageModel2.getClubs());
				// // 活动
				// holder.t_activity.setText(""
				// + personalCenterHomePageModel2.getActivity());
				// // 朋友
				// holder.t_friends.setText(""
				// + personalCenterHomePageModel2.getFriend());

				// 右箭头的
				holder.right.setOnClickListener(new View.OnClickListener() {

					@Override
					public void onClick(View v) {

						holder.one.setVisibility(View.GONE);
						holder.one_line.setVisibility(View.GONE);
						holder.two.setVisibility(View.VISIBLE);
						holder.two_line.setVisibility(View.VISIBLE);
					}
				});
				holder.left.setOnClickListener(new View.OnClickListener() {

					@Override
					public void onClick(View v) {

						holder.one.setVisibility(View.VISIBLE);
						holder.one_line.setVisibility(View.VISIBLE);
						holder.two.setVisibility(View.GONE);
						holder.two_line.setVisibility(View.GONE);
					}
				});

				// 俱乐部主页
				holder.ll_home_page
						.setOnClickListener(new View.OnClickListener() {

							@Override
							public void onClick(View v) {

								if (flags != POST_PERSONAL_CENTE_HOME_PAGE) {
									holder.l_blue1.setVisibility(View.VISIBLE);
									holder.l_blue2
											.setVisibility(View.INVISIBLE);
									ChageToHomePage(uid, fid);
								}
							}
						});
				// 进入到我的图片
				holder.ll_picture
						.setOnClickListener(new View.OnClickListener() {

							@Override
							public void onClick(View v) {
								if (!clubRoleModel.getIsVisit().equals("0")) {
									Intent intent = new Intent(getActivity(),
											SeeClubPolyActivity.class);
									intent.putExtra("uid", uid);
									intent.putExtra("cid", cid);
									intent.putExtra("club_type", club_type);
									if (personalCenterHomePageModel2
											.getIs_apply().equals("0")) {
										intent.putExtra("is_apply", "0");
									} else {
										intent.putExtra("is_apply", "1");
									}
									getActivity().startActivity(intent);
								} else {
									Utils.showMessage(
											getActivity(),
											getResources().getString(
													R.string.wx_txt_52));
								}
							}
						});
				// 记录
				holder.ll_record.setOnClickListener(new View.OnClickListener() {

					@Override
					public void onClick(View v) {
						if (!clubRoleModel.getIsVisit().equals("0")) {
							Intent intent = new Intent(getActivity(),
									RecordListClubActivity.class);
							intent.putExtra("cid", cid);
							intent.putExtra("c_name",
									personalCenterHomePageModel2.getName());
							intent.putExtra("admin_id", admin_id);
							intent.putExtra("is_join", is_join);
							intent.putExtra("gold", personalCenterHomePageModel2.getGold());
							intent.putExtra("price", personalCenterHomePageModel2.getPrice());
							
							if (personalCenterHomePageModel2.getIs_apply()
									.equals("0")) {
								intent.putExtra("is_apply", "0");
							} else {
								intent.putExtra("is_apply", "1");
								intent.putExtra("apply_id",
										personalCenterHomePageModel2
												.getApplyTableId());
							}
							getActivity().startActivity(intent);
						} else {
							Utils.showMessage(getActivity(), getResources()
									.getString(R.string.wx_txt_52));
						}
					}
				});
				// 咨询
				holder.ll_consult
						.setOnClickListener(new View.OnClickListener() {

							@Override
							public void onClick(View v) {
								if (!Utils.getUid(getActivity()).equals("")) {
									Intent intent = new Intent(getActivity(),
											ConsultingActivity.class);
									intent.putExtra("cid", cid);
									intent.putExtra("cj_uid", admin_id);
									intent.putExtra("flags", "0");
									// ("传过去的数据是+" + cid + " "
									// + admin_id);
									getActivity().startActivity(intent);
								} else {
									Utils.showMessage(
											getActivity(),
											getResources().getString(
													R.string.l_xb10));
								}
							}
						});
				// 会员
				holder.ll_members
						.setOnClickListener(new View.OnClickListener() {

							@Override
							public void onClick(View v) {
								// TODO Auto-generated method stub
								Intent intent = new Intent(getActivity(),
										PinyinSeeClubMemberJCZYActivity.class);
								intent.putExtra("cid", cid);
								intent.putExtra("cj_uid", admin_id);
								intent.putExtra("flags", "0");
								// ("传过去的数据是+" + cid + " "
								// + admin_id);
								getActivity().startActivity(intent);
							}
						});

				// (new View.OnClickListener() {
				//
				// @Override
				// public void onClick(View v) {
				//
				// // Intent intent = new Intent(getActivity(),
				// // ClubMyClubActivity.class);
				// // intent.putExtra("uid", uid);
				// // intent.putExtra("fid", fid);
				// // getActivity().startActivity(intent);
				//
				// }
				// });
				// 活动
				holder.ll_activity
						.setOnClickListener(new View.OnClickListener() {

							@Override
							public void onClick(View v) {
								if (!clubRoleModel.getIsVisit().equals("0")) {
									Intent intent = new Intent(getActivity(),
											CalendarClubActivityActivity.class);
									// intent.putExtra("uid", uid);
									intent.putExtra("cid", cid);
									intent.putExtra("c_name",
											personalCenterHomePageModel2
													.getName());
									intent.putExtra("club_type", club_type);
									if (personalCenterHomePageModel2
											.getIs_apply().equals("0")) {
										intent.putExtra("is_apply", "0");
									} else {
										intent.putExtra("is_apply", "1");
									}
									getActivity().startActivity(intent);
								} else {
									Utils.showMessage(
											getActivity(),
											getResources().getString(
													R.string.wx_txt_52));
								}

							}
						});
				// 收藏按钮
				holder.ll_collect
						.setOnClickListener(new View.OnClickListener() {

							@Override
							public void onClick(View v) {
								if (!clubRoleModel.getIsVisit().equals("0")) {
									holder.l_blue1
											.setVisibility(View.INVISIBLE);
									holder.l_blue2.setVisibility(View.VISIBLE);
									ChageToCollect(uid, fid);
								} else {
									Utils.showMessage(
											getActivity(),
											getResources().getString(
													R.string.wx_txt_52));
								}
							}
						});
				// 申请表
				holder.ll_shenqingbiao
						.setOnClickListener(new View.OnClickListener() {

							@Override
							public void onClick(View v) {
								// TODO Auto-generated method stub
								try {
									if (uid.equals(admin_id)) {
										Intent intent = new Intent(
												getActivity(),
												ClubApplicationFormActivity.class);
										intent.putExtra("cid", cid);
										intent.putExtra("showType", "club");
										intent.putExtra("c_name",
												personalCenterHomePageModel2
														.getName());
										getActivity().startActivity(intent);
									} else {
										Toast.makeText(
												getActivity(),
												getResources().getString(
														R.string.wx_txt_54), 0)
												.show();
									}
								} catch (Exception e) {
									// TODO: handle exception
								}
							}
						});
				// // 朋友
				// holder.ll_friends.setOnClickListener(new
				// View.OnClickListener() {
				//
				// @Override
				// public void onClick(View v) {
				// // 自己的和别人的全是这个
				// Intent intent = new Intent(getActivity(),
				// PinyinSeeOtherPeopleFriendActivity.class);
				// intent.putExtra("uid", uid);
				// intent.putExtra("fid", fid);
				// getActivity().startActivity(intent);
				// }
				// });
				// 俱乐部的的资料
				holder.ll_data.setOnClickListener(new View.OnClickListener() {

					@Override
					public void onClick(View v) {

						if (club_type.equals("1")) {
							Intent intent = new Intent(getActivity(),
									ClubDataGLYActivity.class);
							intent.putExtra("cid", cid);
							getActivity().startActivity(intent);
						}
						// else if (club_type.equals("2") ) {
						// Intent intent = new Intent(getActivity(),
						// ClubDataHuiYuanActivity.class);
						// intent.putExtra("cid", cid);
						// getActivity().startActivity(intent);
						// }
						else {
							// Toast.makeText(getActivity(),
							// getResources().getString(R.string.wx_txt_53), 0)
							// .show();
							Intent intent = new Intent(getActivity(),
									ClubDataHuiYuanActivity.class);
							intent.putExtra("cid", cid);
							getActivity().startActivity(intent);
						}

					}
				});
				// 其他空间
				// holder.ll_otherspace
				// .setOnClickListener(new View.OnClickListener() {
				//
				// @Override
				// public void onClick(View v) {
				// if (!clubRoleModel.getIsVisit().equals("0")) {
				// Intent intent = new Intent(getActivity(),
				// ClubOtherSpaceActivity.class);
				// // intent.putExtra("uid", uid);
				// intent.putExtra("cid", cid);
				// // intent.putExtra("fid", fid);
				// getActivity().startActivity(intent);
				// } else {
				// Utils.showMessage(
				// getActivity(),
				// getResources().getString(
				// R.string.wx_txt_52));
				// }
				// }
				// });

				// public LinearLayout ll_home_page;//个人主页
				// public LinearLayout ll_picture;//照片
				// public LinearLayout ll_record;//记录
				// public LinearLayout ll_club;//俱乐部
				// public LinearLayout ll_activity;//活动
				// //two
				// public LinearLayout ll_collect;//收藏
				// public LinearLayout ll_friends;//朋友
				// public LinearLayout ll_data;//资料
				// public LinearLayout ll_otherSpace;//其他空间

			}
		}
	}

	/**
	 * 转为俱乐部主页
	 * 
	 * @param uid2
	 * @param fid2
	 */
	protected void ChageToHomePage(String uid2, String fid2) {

		if (flags != POST_PERSONAL_CENTE_HOME_PAGE) {
			flags = POST_PERSONAL_CENTE_HOME_PAGE;
			user_trends = new ArrayList<User_trends_Model>();
			user_trends.add(new User_trends_Model());// 这是个站位符号
			page = 0;
			if (xListView1 != null)
				xListView1.startLoadMore();
		}

	}

	/**
	 * 转为收藏
	 * 
	 * @param uid
	 * @param fid
	 */
	public void ChageToCollect(String uid, String fid) {
		if (flags != POST_COLLECT) {
			flags = POST_COLLECT;
			user_trends = new ArrayList<User_trends_Model>();
			user_trends.add(new User_trends_Model());// 这是个站位符号
			page = 0;
			if (xListView1 != null)
				xListView1.startLoadMore();
		}
	}

	// TODO Auto-generated method stub
	/**
	 * 初始化记录视图id
	 * 
	 * @param convertView
	 * @param holder
	 */
	public void initRecordId(View convertView, ViewHolder holder) {
		holder.drop_down = (ImageView) convertView.findViewById(R.id.drop_down);
		// 删除和举报按钮
		// holder.delete_hands = (Button) convertView
		// .findViewById(R.id.delete_hands);
		// 昵称
		holder.nickName = (TextView) convertView.findViewById(R.id.nickName);
		// 内容
		holder.content = (TextView) convertView.findViewById(R.id.content);

		// 发表时间
		holder.time = (TextView) convertView.findViewById(R.id.time);
		// 头像
		holder.head = (ImageView) convertView.findViewById(R.id.head);
		// 头像
		holder.image = (ImageView) convertView.findViewById(R.id.image);
		// 活动开始时间和结束时间
		holder.start_timeaddend_time = (TextView) convertView
				.findViewById(R.id.start_timeaddend_time);
		// 浏览
		holder.view = (TextView) convertView.findViewById(R.id.view);
		// 评论
		holder.discuss = (TextView) convertView.findViewById(R.id.discuss);
		// 收藏
		holder.collect = (TextView) convertView.findViewById(R.id.collect);
		// 需要点击的评论
		holder.ll_discuss = (LinearLayout) convertView
				.findViewById(R.id.ll_discuss);
		holder.is_collected = (ImageView) convertView
				.findViewById(R.id.is_collected);
		holder.ll_link = (LinearLayout) convertView.findViewById(R.id.ll_link);
	}

	/**
	 * 显示记录动态
	 * 
	 * @param convertView
	 * @param holder
	 * @param pos
	 */
	public void RecordDongtai(View convertView, ViewHolder holder, final int pos) {
		holder.ll_link.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(getActivity(),
						LogReadingActivity.class);
				intent.putExtra("rid", user_trends.get(pos).getId());
				intent.putExtra("jilu_fabiao_uid", user_trends.get(pos)
						.getUid());
				getActivity().startActivity(intent);
			}
		});
		// 删除和举报按钮
		// holder.delete_hands
		// .setText("" + user_trends.get(pos).getDelete_hands());
		// 删除和举报
		if (user_trends.get(pos).getDelete_hands() != null) {
			drop(user_trends, pos, holder.drop_down);
		}
		// 昵称
		holder.nickName.setText("" + user_trends.get(pos).getNickName());
		holder.nickName.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (!StringUtil.isNullOrEmpty(user_trends.get(pos).getUid())) {
					if (user_trends.get(pos).getUid()
							.equals("" + Utils.getUid(getActivity()))) {
						// ((AfterLandingActivity) (getActivity())).jiazai(9);
						Intent intent = new Intent(getActivity(),
								MyDataActivity.class);
						// intent.putExtra("isStartTwoClose", true);
						startActivity(intent);

					} else {
						Intent intent = new Intent(getActivity(),
								SeeOtherPeopleSpaceActivity.class);
						intent.putExtra("friend_id", user_trends.get(pos)
								.getUid());

						startActivity(intent);
					}
				}

			}
		});
		// 发表时间
		holder.time.setText(""
				+ CalendarTools.getTimeChangeToString(getActivity(),
						user_trends.get(pos).getTime()));
		// 头像
		try {
			ImageLoader.getInstance().displayImage(
					Constants.BadiDownImgUrl + "/"
							+ user_trends.get(pos).getHead()
							+ Constants.appPhoto4img, holder.head, options);
		} catch (Exception e) {
		}
		holder.head.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (!StringUtil.isNullOrEmpty(user_trends.get(pos).getUid())) {
					if (user_trends.get(pos).getUid()
							.equals("" + Utils.getUid(getActivity()))) {
						// ((AfterLandingActivity) (getActivity())).jiazai(9);
						Intent intent = new Intent(getActivity(),
								MyDataActivity.class);
						// intent.putExtra("isStartTwoClose", true);
						startActivity(intent);

					} else {
						Intent intent = new Intent(getActivity(),
								SeeOtherPeopleSpaceActivity.class);
						intent.putExtra("friend_id", user_trends.get(pos)
								.getUid());

						startActivity(intent);
					}
				}

			}
		});
		//
		// finalBitmap.display(holder.head, Constants.BadiDownImgUrl + "/"
		// + user_trends.get(pos).getHead());
		// 头
		try {
			ImageLoader.getInstance().displayImage(
					Constants.BadiDownImgUrl + "/"
							+ user_trends.get(pos).getImage()
							+ Constants.App9block, holder.image, options);
		} catch (Exception e) {

		}

		// finalBitmap.display(holder.image, Constants.BadiDownImgUrl + "/"
		// + user_trends.get(pos).getImage());

		// // 活动开始时间和结束时间
		// if(user_trends.get(pos).getStart_time()!=null &&
		// user_trends.get(pos).getEnd_time()!=null)
		// {
		// String
		// start_time=(user_trends.get(pos).getStart_time().replaceAll("-",
		// ".")).substring(0, 10);
		// String end_time=(user_trends.get(pos).getEnd_time().replaceAll("-",
		// ".")).substring(0, 10);
		// holder.start_timeaddend_time.setText(""
		// + start_time + "-"
		// + end_time);
		// }

		// 活动开始时间和结束时间
		holder.start_timeaddend_time.setText(""
				+ Utils.Back_Data(user_trends.get(pos).getStart_time()) + "-"
				+ Utils.Back_Data(user_trends.get(pos).getEnd_time()));
		// >>>>>>> .r244
		// 浏览
		holder.view.setText("" + user_trends.get(pos).getView());
		// 评论
		holder.discuss.setText("" + user_trends.get(pos).getDiscuss());
		// 收藏
		holder.collect.setText("" + user_trends.get(pos).getCollect());
		holder.content.setText("" + user_trends.get(pos).getTitle());

		// 点击评论
		holder.ll_discuss.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				// User_trends_Model u = user_trends.get(pos);
				// u.setClub_id(cid);
				// String path = IOUtils.getSavePinLunObjectPath(getActivity());
				// // 将序列化对象写入sdcard 在AfterLandingDongTaiDiscussFragment中去
				// IOUtils.WriteSerializedObjectsToSDcard(path, (Object) u);
				//
				// ((AfterLandingActivity) (getActivity())).jiazai(13);
				if (!Utils.getUid(getActivity()).equals("")) {

				} else {
					Utils.showMessage(getActivity(),
							getResources().getString(R.string.l_xb10));
				}
			}
		});

		// 是否收藏

		if (flags == POST_COLLECT) {
			user_trends.get(pos).setIs_collected(1);
		}

		if (user_trends.get(pos).getIs_collected() == 1) {
			holder.is_collected.setSelected(true);
			holder.is_collected.setOnClickListener(new View.OnClickListener() {

				@Override
				public void onClick(View v) {
					if (!Utils.getUid(getActivity()).equals("")) {

					} else {
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.l_xb10));
					}
				}
			});
		} else {
			holder.is_collected.setSelected(false);
			holder.is_collected.setOnClickListener(new View.OnClickListener() {

				@Override
				public void onClick(View v) {
					if (!Utils.getUid(getActivity()).equals("")) {
						pos_ = pos;
						//
						// + user_trends.get(pos).getId() + "/"
						// + user_trends.get(pos).getType());
						if (club_type.equals("1")) {
							collect(cid, user_trends.get(pos).getUid(),
									user_trends.get(pos).getId(), user_trends
											.get(pos).getType());
						} else {
							Utils.showMessage(getActivity(), getResources()
									.getString(R.string.wx_txt_107));
						}
					} else {
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.l_xb10));
					}
				}
			});
		}
		// //缺活动时间
		// //'record' 对应的属性
		// //public String type;//类型 用于判断接收返回值是选用的model
		// public TextView view;//浏览次数
		// //public String discuss;//评论次数
		// //public String collect;//收藏次数
		// //public String id;//该记录的id
		// //public String time;//记录添加时间
		// public ImageView image;//封面图
		// public TextView content;//记录的内容
		// //public String delete_hands;//自己 为删除 别的人 举报
		// //public String nickName;//发表信息用户昵称
		// //private String head//发表信息用户头像
		// //private String uid//发表信息的用户id
		// public String start_time;//开始时间
		// public String end_time;//结束时间
	}

	// TODO Auto-generated method stub
	/**
	 * 初始化俱乐部id
	 * 
	 * @param convertView
	 * @param holder
	 */
	private void initClubId(View convertView, ViewHolder holder) {
		holder.drop_down = (ImageView) convertView.findViewById(R.id.drop_down);
		/**
		 * zan
		 */
		holder.is_praise = (ImageView) convertView.findViewById(R.id.is_praise);
		// 昵称
		holder.nickName = (TextView) convertView.findViewById(R.id.nickName);
		// // 删除和举报按钮
		// holder.delete_hands = (Button) convertView
		// .findViewById(R.id.delete_hands);
		// 头像
		holder.head = (ImageView) convertView.findViewById(R.id.head);
		// 发表时间
		holder.time = (TextView) convertView.findViewById(R.id.time);
		// 俱乐部名
		holder.name = (TextView) convertView.findViewById(R.id.name);
		// 俱乐部地址
		holder.originate_address = (TextView) convertView
				.findViewById(R.id.originate_address);
		// 俱乐部种类
		holder.typeName = (TextView) convertView.findViewById(R.id.typeName);
		// 加入俱乐部需要的金币数量
		holder.price = (TextView) convertView.findViewById(R.id.price);
		// 获赞次数
		holder.admire = (TextView) convertView.findViewById(R.id.admire);
		// 评论次数
		holder.discuss = (TextView) convertView.findViewById(R.id.discuss);
		// 收藏次数
		holder.collect = (TextView) convertView.findViewById(R.id.collect);
		// 分享次数
		holder.share = (TextView) convertView.findViewById(R.id.share);
		// LOGO
		holder.logo = (ImageView) convertView.findViewById(R.id.logo);
		// 评论
		//
		holder.ll_admire = (LinearLayout) convertView
				.findViewById(R.id.ll_admire);
		holder.ll_discuss = (LinearLayout) convertView
				.findViewById(R.id.ll_discuss);
		holder.ll_collect = (LinearLayout) convertView
				.findViewById(R.id.ll_collect);
		holder.ll_share = (LinearLayout) convertView
				.findViewById(R.id.ll_share);
		holder.ll_link = (LinearLayout) convertView.findViewById(R.id.ll_link);
		// public LinearLayout ll_admire,ll_dicuss,ll_share;//ll_collect,
	}

	/**
	 * 显示创建俱乐部动态
	 * 
	 * @param convertView
	 * @param holder
	 * @param pos
	 */
	public void CreateClubDongtai(View convertView, final ViewHolder holder,
			final int pos) {
		holder.ll_link.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(getActivity(),
						ClubHomepageActivity.class);

				intent.putExtra("cid", user_trends.get(pos).getCid());
				startActivity(intent);
			}
		});

		// 昵称
		holder.nickName.setText("" + user_trends.get(pos).getNickName());
		holder.nickName.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (!StringUtil.isNullOrEmpty(user_trends.get(pos).getUid())) {
					if (user_trends.get(pos).getUid()
							.equals("" + Utils.getUid(getActivity()))) {
						// ((AfterLandingActivity) (getActivity())).jiazai(9);
						Intent intent = new Intent(getActivity(),
								MyDataActivity.class);
						// intent.putExtra("isStartTwoClose", true);
						startActivity(intent);

					} else {
						Intent intent = new Intent(getActivity(),
								SeeOtherPeopleSpaceActivity.class);
						intent.putExtra("friend_id", user_trends.get(pos)
								.getUid());

						startActivity(intent);
					}
				}

			}
		});
		// 是否已经赞过
		if (user_trends.get(pos).getIs_praise().equals("1")) {
			holder.is_praise.setSelected(true);
			holder.is_praise.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					if (!Utils.getUid(getActivity()).equals("")) {

					} else {
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.l_xb10));
					}
				}
			});

		} else // 0未赞
		{
			holder.is_praise.setSelected(false);
			holder.is_praise.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					if (!Utils.getUid(getActivity()).equals("")) {
						change_view = holder.is_praise;
						dianzan(getActivity(), Utils.getUid(getActivity()),
								user_trends.get(pos).getId(),
								user_trends.get(pos).getUid(),
								user_trends.get(pos).getType(), pos);
					} else {
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.l_xb10));
					}
				}
			});
		}

		// 删除和举报按钮
		// holder.delete_hands
		// .setText("" + user_trends.get(pos).getDelete_hands());

		// 删除和举报
		if (user_trends.get(pos).getDelete_hands() != null) {
			drop(user_trends, pos, holder.drop_down);
		}
		try {
			// 头像
			ImageLoader.getInstance().displayImage(
					Constants.BadiDownImgUrl + "/"
							+ user_trends.get(pos).getHead()
							+ Constants.appPhoto4img, holder.head, options);
		} catch (Exception e) {

		}
		holder.head.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (!StringUtil.isNullOrEmpty(user_trends.get(pos).getUid())) {
					if (user_trends.get(pos).getUid()
							.equals("" + Utils.getUid(getActivity()))) {
						// ((AfterLandingActivity) (getActivity())).jiazai(9);
						Intent intent = new Intent(getActivity(),
								MyDataActivity.class);
						// intent.putExtra("isStartTwoClose", true);
						startActivity(intent);

					} else {
						Intent intent = new Intent(getActivity(),
								SeeOtherPeopleSpaceActivity.class);
						intent.putExtra("friend_id", user_trends.get(pos)
								.getUid());

						startActivity(intent);
					}
				}

			}
		});
		// 发表时间
		holder.time.setText(""
				+ CalendarTools.getTimeChangeToString(getActivity(),
						user_trends.get(pos).getTime()));
		// 俱乐部名
		holder.name.setText("" + user_trends.get(pos).getName());

		// 俱乐部地址
		holder.originate_address.setText(""
				+ user_trends.get(pos).getOriginate_address());
		// 俱乐部种类
		// <<<<<<< .mine
		holder.typeName.setText(""
				+ user_trends.get(pos).getTypeName().getName());
		// =======
		// holder.typeName.setText("" + user_trends.get(pos).getType_name());
		// >>>>>>> .r239

		// 加入俱乐部需要的金币数量
		holder.price.setText("" + user_trends.get(pos).getPrice());

		// 获赞次数
		holder.admire.setText("" + user_trends.get(pos).getAdmire());
		// 评论次数
		holder.discuss.setText("" + user_trends.get(pos).getDiscuss());
		// 收藏次数
		holder.collect.setText("" + user_trends.get(pos).getCollect());
		// 分享次数
		holder.share.setText("" + user_trends.get(pos).getShare());
		// LOGO
		try {
			ImageLoader.getInstance().displayImage(
					Constants.BadiDownImgUrl + "/"
							+ user_trends.get(pos).getLogo()
							+ Constants.App9block, holder.logo, options);
		} catch (Exception e) {

		}
		// 点击赞
		holder.ll_admire.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {

				// 收费的
				if (!Utils.getUid(getActivity()).equals("")) {

				} else {
					Utils.showMessage(getActivity(),
							getResources().getString(R.string.l_xb10));
				}
			}
		});
		// 点击评论
		holder.ll_discuss.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				if (!Utils.getUid(getActivity()).equals("")) {
					User_trends_Model u = user_trends.get(pos);
					u.setClub_id(cid);
					// String path =
					// IOUtils.getSavePinLunObjectPath(getActivity());
					// // 将序列化对象写入sdcard 在AfterLandingDongTaiDiscussFragment中去
					// IOUtils.WriteSerializedObjectsToSDcard(path, (Object) u);
					//
					// ((AfterLandingActivity) (getActivity())).jiazai(13);
					Intent intent = new Intent(getActivity(),
							LookAtTheDetailedActivity.class);
					intent.putExtra("User_trends_Model", u);
					startActivity(intent);
				} else {
					Utils.showMessage(getActivity(),
							getResources().getString(R.string.l_xb10));
				}
			}
		});
		// 点击收藏
		holder.ll_collect.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (!Utils.getUid(getActivity()).equals("")) {

				} else {
					Utils.showMessage(getActivity(),
							getResources().getString(R.string.l_xb10));
				}
			}
		});
		// 分享
		holder.ll_share.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {

				if (!Utils.getUid(getActivity()).equals("")) {
					if (!StringUtil.isNullOrEmpty(user_trends.get(pos)
							.getLogo())) {
						ShareSDKTools.ShowOneKeyShare(getActivity(), "分享",
								user_trends.get(pos).getName(), "",
								Constants.BadiDownImgUrl + "/"
										+ user_trends.get(pos).getLogo()
										+ Constants.appPhoto4img, "club",
								user_trends.get(pos).getId(),
								user_trends.get(pos).getUid(), cid, "club");
					} else {
						ShareSDKTools.ShowOneKeyShare(getActivity(), "分享",
								user_trends.get(pos).getName(), "", "", "club",
								user_trends.get(pos).getId(),
								user_trends.get(pos).getUid(), cid, "club");
					}

					ShareSDKTools
							.setOnShareFinishCallBack(new ShareSDKTools.CallBack() {

								@Override
								public void ShareFinishCallBack() {
									// TODO Auto-generated method stub
									int a = Integer.parseInt(user_trends.get(
											pos).getShare());
									user_trends.get(pos).setShare("" + (a + 1));

									try {
										x1Adapter.notifyDataSetChanged();

									} catch (Exception e) {
										// TODO: handle exception
									}

								}
							});
				} else {
					Utils.showMessage(getActivity(),
							getResources().getString(R.string.l_xb10));
				}
			}
		});
		// finalBitmap.display(holder.logo, Constants.BadiDownImgUrl + "/"
		// + user_trends.get(pos).getLogo());
		// 缺俱乐部类型
		// 赞
		// 评论
		// 分享
		// 收藏

		// //'club' 对应的属性 （俱乐部)
		// private TextView nickName;//用户昵称
		// private ImageView head;//用户头像
		// private String uid;//发表信息的用户id
		// private String cid;//俱乐部id
		// private String name;//俱乐部名称
		// private String logo;//俱乐部logo
		// private String originate_address;//俱乐部地址
		// private String price;//俱乐部加入所需金币
		// private Button delete_hands;//自己 为删除 别的人 举报
		// //private String time;

		// private String discuss; //评论
		// private String admire; //赞
		// private String collect; //收藏
		// private String share; //分享
		// private String typeName;//俱乐部类型
	}

	// TODO Auto-generated method stub
	/**
	 * 初始化上传图片id
	 * 
	 * @param convertView
	 * @param holder
	 */
	public void initUpPictureId(View convertView, ViewHolder holder) {
		holder.drop_down = (ImageView) convertView.findViewById(R.id.drop_down);
		/**
		 * 是否已经赞过了
		 */
		holder.is_praise = (ImageView) convertView.findViewById(R.id.is_praise);
		holder.head = (ImageView) convertView.findViewById(R.id.head);
		// 昵称
		holder.nickName = (TextView) convertView.findViewById(R.id.nickName);
		// 发表时间
		holder.time = (TextView) convertView.findViewById(R.id.time);
		// 删除和举报按钮
		// holder.delete_hands = (Button) convertView
		// .findViewById(R.id.delete_hands);
		// 获赞次数
		holder.reprint = (TextView) convertView.findViewById(R.id.reprint);
		// 评论次数
		holder.comment = (TextView) convertView.findViewById(R.id.comment);
		// 上传图片次数
		holder.img_count = (TextView) convertView.findViewById(R.id.img_count);
		// 到哪一个相册
		holder.photo_name = (TextView) convertView
				.findViewById(R.id.photo_name);
		// 九张小图
		holder.gv_xinqingpicture = (GridView) convertView
				.findViewById(R.id.xinqingpicture);

		// 用来计算图片的宽typeName
		holder.l_width = (LinearLayout) convertView.findViewById(R.id.l_width);
		// 评论
		holder.ll_discuss = (LinearLayout) convertView
				.findViewById(R.id.ll_discuss);
		holder.ll_link = (LinearLayout) convertView.findViewById(R.id.ll_link);
	}

	/**
	 * 显示上传图片动态
	 * 
	 * @param convertView
	 * @param holder
	 * @param pos
	 */
	public void UpPictureDongtai(View convertView, final ViewHolder holder,
			final int pos) {

		holder.ll_link.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (user_trends.get(pos).getUid()
						.equals(Utils.getUid(getActivity()))) {
					Intent intent = new Intent(getActivity(),
							MyPoly1Activity.class);
					startActivity(intent);
				} else {
					Intent intent = new Intent(getActivity(),
							SeeOtherPeoplePolyActivity.class);
					intent.putExtra("uid", user_trends.get(pos).getUid());
					startActivity(intent);
				}

			}
		});
		// int w = (int) Utils.GetAssemblyWidth(holder.l_width);
		//

		// 是否已经赞过
		// 是否已经赞过
		if (user_trends.get(pos).getIs_praise().equals("1")) {
			holder.is_praise.setSelected(true);
			holder.is_praise.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

				}
			});

		} else // 0未赞
		{
			holder.is_praise.setSelected(false);
			holder.is_praise.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {

					change_view = holder.is_praise;
					dianzan(getActivity(), Utils.getUid(getActivity()),
							user_trends.get(pos).getId(), user_trends.get(pos)
									.getUid(), user_trends.get(pos).getType(),
							pos);

				}
			});
		}
		try {
			ImageLoader.getInstance().displayImage(
					Constants.BadiDownImgUrl + "/"
							+ user_trends.get(pos).getHead()
							+ Constants.appPhoto4img, holder.head, options);
		} catch (Exception e) {

		}
		holder.head.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (!StringUtil.isNullOrEmpty(user_trends.get(pos).getUid())) {
					if (user_trends.get(pos).getUid()
							.equals("" + Utils.getUid(getActivity()))) {
						// ((AfterLandingActivity) (getActivity())).jiazai(9);
						Intent intent = new Intent(getActivity(),
								MyDataActivity.class);
						// intent.putExtra("isStartTwoClose", true);
						startActivity(intent);

					} else {
						Intent intent = new Intent(getActivity(),
								SeeOtherPeopleSpaceActivity.class);
						intent.putExtra("friend_id", user_trends.get(pos)
								.getUid());

						startActivity(intent);
					}
				}

			}
		});
		// 昵称
		holder.nickName.setText("" + user_trends.get(pos).getNickName());
		holder.nickName.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (!StringUtil.isNullOrEmpty(user_trends.get(pos).getUid())) {
					if (user_trends.get(pos).getUid()
							.equals("" + Utils.getUid(getActivity()))) {
						// ((AfterLandingActivity) (getActivity())).jiazai(9);
						Intent intent = new Intent(getActivity(),
								MyDataActivity.class);
						// intent.putExtra("isStartTwoClose", true);
						startActivity(intent);

					} else {
						Intent intent = new Intent(getActivity(),
								SeeOtherPeopleSpaceActivity.class);
						intent.putExtra("friend_id", user_trends.get(pos)
								.getUid());

						startActivity(intent);
					}
				}

			}
		});
		// 发表时间
		holder.time.setText(""
				+ CalendarTools.getTimeChangeToString(getActivity(),
						user_trends.get(pos).getTime()));
		// // 删除和举报按钮
		// holder.delete_hands
		// .setText("" + user_trends.get(pos).getDelete_hands());

		// 删除和举报
		if (user_trends.get(pos).getDelete_hands() != null) {
			drop(user_trends, pos, holder.drop_down);
		}
		// 获赞次数
		holder.reprint.setText("" + user_trends.get(pos).getReprint());
		// 评论次数
		holder.comment.setText("" + user_trends.get(pos).getComment());

		// 上传图片次数
		holder.img_count.setText("" + user_trends.get(pos).getImg_count());
		// 到哪一个相册
		holder.photo_name.setText("" + user_trends.get(pos).getPhoto_name());
		holder.photo_name.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(getActivity(),
						UpPicturesActivity.class);
				intent.putExtra("photoid", user_trends.get(pos).getId());
				startActivity(intent);
			}
		});
		// int wh = (w / 3 - 2);

		// 图片的
		if (user_trends.get(pos).getImg() != null) {
			holder.gv_xinqingpicture.setVisibility(View.VISIBLE);
			String[] img = new String[user_trends.get(pos).getImg().size()];
			for (int i = 0; i < user_trends.get(pos).getImg().size(); i++) {
				img[i] = user_trends.get(pos).getImg().get(i).getPath();
			}
			GridViewSHUZHUAdapter shuzhuAdapter = new GridViewSHUZHUAdapter(
					getActivity(), img);
			holder.gv_xinqingpicture.setAdapter(shuzhuAdapter);
			holder.gv_xinqingpicture
					.setOnItemClickListener(new AdapterView.OnItemClickListener() {

						@Override
						public void onItemClick(AdapterView<?> arg0, View view,
								int position, long arg3) {
							// TODO Auto-generated method stub
							// user_trends.get(pos).getImg().get(position).getPath();
							Intent intent = new Intent(getActivity(),
									PicturePreviewActivity.class);
							List<BrowseAllPhoto_Model> ll = new ArrayList<BrowseAllPhoto_Model>();
							for (int i = 0; i < user_trends.get(pos).getImg()
									.size(); i++) {
								BrowseAllPhoto_Model bm = new BrowseAllPhoto_Model();
								bm.setId(user_trends.get(pos).getImg().get(i)
										.getId());
								bm.setPath(user_trends.get(pos).getImg().get(i)
										.getPath());
								ll.add(bm);
							}
							intent.putExtra("picture_list", (Serializable) ll);
							intent.putExtra("picture_postion", position);
							getActivity().startActivity(intent);

						}
					});

		} else {
			holder.gv_xinqingpicture.setVisibility(View.GONE);
		}
		// 点击评论
		holder.ll_discuss.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (!Utils.getUid(getActivity()).equals("")) {
					User_trends_Model u = user_trends.get(pos);
					u.setClub_id(cid);
					// String path =
					// IOUtils.getSavePinLunObjectPath(getActivity());
					// // 将序列化对象写入sdcard 在AfterLandingDongTaiDiscussFragment中去
					// IOUtils.WriteSerializedObjectsToSDcard(path, (Object) u);
					//
					// ((AfterLandingActivity) (getActivity())).jiazai(13);
					Intent intent = new Intent(getActivity(),
							LookAtTheDetailedActivity.class);
					intent.putExtra("User_trends_Model", u);
					startActivity(intent);
				} else {
					Utils.showMessage(getActivity(),
							getResources().getString(R.string.l_xb10));
				}
			}
		});

	}

	// TODO Auto-generated method stub
	/**
	 * 初始化心情动态id
	 * 
	 * @param convertView
	 * @param holder
	 */
	public void initDongTaiId(View convertView, ViewHolder holder) {
		holder.drop_down = (ImageView) convertView.findViewById(R.id.drop_down);
		// 显示上传的图片
		holder.gv_xinqingpicture = (GridView) convertView
				.findViewById(R.id.xinqingpicture);
		/**
		 * 是否已经赞过了
		 */
		holder.is_praise = (ImageView) convertView.findViewById(R.id.is_praise);
		// 详细
		holder.xiangxi = (TextView) convertView.findViewById(R.id.xiangxi);
		// 昵称
		holder.nickName = (TextView) convertView.findViewById(R.id.nickName);
		// 头像
		holder.head = (ImageView) convertView.findViewById(R.id.head);
		// 昵称
		holder.addtime = (TextView) convertView.findViewById(R.id.addtime);
		// 内容
		holder.contents = (TextView) convertView.findViewById(R.id.contents);
		// // 删除和举报按钮
		// holder.delete_hands = (Button) convertView
		// .findViewById(R.id.delete_hands);
		// 地点
		holder.address = (TextView) convertView.findViewById(R.id.address);
		// 获赞次数
		holder.admire = (TextView) convertView.findViewById(R.id.admire);
		// 评论次数
		holder.discuss = (TextView) convertView.findViewById(R.id.discuss);
		// 发表时间
		holder.addtime = (TextView) convertView.findViewById(R.id.addtime);
		// 收藏次数
		holder.collect = (TextView) convertView.findViewById(R.id.collect);
		// 分享次数
		holder.share = (TextView) convertView.findViewById(R.id.share);
		//
		// is_collected
		holder.ll_admire = (LinearLayout) convertView
				.findViewById(R.id.ll_admire);
		holder.ll_discuss = (LinearLayout) convertView
				.findViewById(R.id.ll_discuss);
		holder.ll_collect = (LinearLayout) convertView
				.findViewById(R.id.ll_collect);
		holder.ll_share = (LinearLayout) convertView
				.findViewById(R.id.ll_share);
		holder.is_collected = (ImageView) convertView
				.findViewById(R.id.is_collected);
		holder.xinqingaddress = (TextView) convertView
				.findViewById(R.id.xinqinaddress);
		holder.pictureNum = (TextView) convertView
				.findViewById(R.id.pictureNum);

		holder.videoimage = (ImageView) convertView
				.findViewById(R.id.videoimage);
		holder.videotitle = (TextView) convertView
				.findViewById(R.id.videotitle);
		holder.videoxianshi = (LinearLayout) convertView
				.findViewById(R.id.videoxianshi);
	}

	/**
	 * 显示心情动态
	 * 
	 * @param convertView
	 * @param holder
	 * @param pos
	 */
	public void XinQingDongtai(View convertView, final ViewHolder holder,
			final int pos) {
		holder.pictureNum.setVisibility(View.GONE);
		// 心情动态图片显示","隔开
		if (user_trends != null)
			if (!StringUtil.isNullOrEmpty(user_trends.get(pos).getTrends_img())) {

				holder.gv_xinqingpicture.setVisibility(View.VISIBLE);
				try {
					String xinqingtupians = user_trends.get(pos)
							.getTrends_img();
					String xinqingids = user_trends
							.get(pos)
							.getImgIdStr()
							.substring(1,
									user_trends.get(pos).getImgIdStr().length());
					String[] xinqingtupian = xinqingtupians.split(",");
					String[] xinqingid = xinqingids.split(",");
					if (xinqingid.length > 9) {
						holder.pictureNum.setVisibility(View.VISIBLE);
						String a = String.format(
								getResources().getString(R.string.wx2_13), ""
										+ xinqingid.length);
						holder.pictureNum.setText(a);
					} else {
						holder.pictureNum.setVisibility(View.GONE);
					}
					final GridViewSHUZHUAdapter adapter = new GridViewSHUZHUAdapter(
							getActivity(), xinqingtupian, xinqingid);
					holder.gv_xinqingpicture.setAdapter(adapter);
					holder.gv_xinqingpicture
							.setOnItemClickListener(new OnItemClickListener() {

								@Override
								public void onItemClick(AdapterView<?> arg0,
										View arg1, int position, long arg3) {
									// TODO Auto-generated method stub
									Intent intent = new Intent(getActivity(),
											PicturePreviewActivity.class);
									intent.putExtra("picture_list",
											(Serializable) adapter
													.getBrowseAllPhoto_Model());
									intent.putExtra("picture_postion", position);
									//
									// + adapter.getBrowseAllPhoto_Model()
									// .toString() + " "
									// + position);
									startActivity(intent);
								}
							});
					if (xinqingtupian[0] != null)
						ShareImage = xinqingtupian[0];
				} catch (Exception e) {
					// TODO: handle exception
				}

			} else {
				holder.gv_xinqingpicture.setVisibility(View.GONE);
			}
		// 网页显示视频
		try {
			if (user_trends.get(pos).getVideo_str() != null) {

				holder.videoxianshi.setVisibility(View.VISIBLE);
				ImageLoader.getInstance().displayImage(

				user_trends.get(pos).getVideo_str().getImg().getLarge(),
						holder.videoimage, options);
				holder.videotitle.setText(""
						+ user_trends.get(pos).getVideo_str().getTitle());
				holder.videoxianshi.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View v) {

						// 跳转网页

						Uri uri = Uri.parse(user_trends.get(pos).getVideo_str()
								.getUrl());
						Intent intent = new Intent(Intent.ACTION_VIEW, uri);

						startActivity(intent);

					}
				});

			} else {

				holder.videoxianshi.setVisibility(View.GONE);
			}

		} catch (Exception e) {

		}

		// 是否已经赞过
		if (user_trends.get(pos).getIs_praise() != null)
			if (user_trends.get(pos).getIs_praise().equals("1")) {
				holder.is_praise.setSelected(true);
				holder.is_praise.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View v) {
						if (!Utils.getUid(getActivity()).equals("")) {

						} else {
							Utils.showMessage(getActivity(), getResources()
									.getString(R.string.l_xb10));
						}
					}
				});

			} else // 0未赞
			{
				holder.is_praise.setSelected(false);
				holder.is_praise.setOnClickListener(new OnClickListener() {

					@Override
					public void onClick(View v) {
						if (!Utils.getUid(getActivity()).equals("")) {
							change_view = holder.is_praise;
							dianzan(getActivity(), Utils.getUid(getActivity()),
									user_trends.get(pos).getId(), user_trends
											.get(pos).getUid(), user_trends
											.get(pos).getType(), pos);
						} else {
							Utils.showMessage(getActivity(), getResources()
									.getString(R.string.l_xb10));
						}

					}
				});
			}
		// 点击头像后头像进入到资料
		// if
		// (!Utils.getUid(getActivity()).equals(user_trends.get(pos).getUid()))
		// {
		// holder.head.setOnClickListener(new View.OnClickListener() {
		//
		// @Override
		// public void onClick(View v) {
		//
		// ((AfterLandingActivity) getActivity()).jiazai(11);
		// }
		// });
		// } else {
		// holder.head.setOnClickListener(new View.OnClickListener() {
		// @Override
		// public void onClick(View v) {
		//
		// }
		// });
		// }

		// 头像
		try {
			ImageLoader.getInstance().displayImage(
					Constants.BadiDownImgUrl + "/"
							+ user_trends.get(pos).getHead()
							+ Constants.appPhoto4img, holder.head, options);
		} catch (Exception e) {

		}
		holder.head.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (!StringUtil.isNullOrEmpty(user_trends.get(pos).getUid())) {
					if (user_trends.get(pos).getUid()
							.equals("" + Utils.getUid(getActivity()))) {
						// ((AfterLandingActivity) (getActivity())).jiazai(9);
						Intent intent = new Intent(getActivity(),
								MyDataActivity.class);
						// intent.putExtra("isStartTwoClose", true);
						startActivity(intent);

					} else {
						Intent intent = new Intent(getActivity(),
								SeeOtherPeopleSpaceActivity.class);
						intent.putExtra("friend_id", user_trends.get(pos)
								.getUid());

						startActivity(intent);
					}
				}

			}
		});
		// finalBitmap.display(holder.head, Constants.BadiDownImgUrl + "/"
		// + user_trends.get(pos).getHead());
		// 昵称
		holder.nickName.setText("" + user_trends.get(pos).getNickName());
		holder.nickName.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (!StringUtil.isNullOrEmpty(user_trends.get(pos).getUid())) {
					if (user_trends.get(pos).getUid()
							.equals("" + Utils.getUid(getActivity()))) {
						// ((AfterLandingActivity) (getActivity())).jiazai(9);
						Intent intent = new Intent(getActivity(),
								MyDataActivity.class);
						// intent.putExtra("isStartTwoClose", true);
						startActivity(intent);

					} else {
						Intent intent = new Intent(getActivity(),
								SeeOtherPeopleSpaceActivity.class);
						intent.putExtra("friend_id", user_trends.get(pos)
								.getUid());

						startActivity(intent);
					}
				}

			}
		});
		// 点击内容后进入到资料
		if (!Utils.getUid(getActivity()).equals(user_trends.get(pos).getUid())) {
			holder.contents.setAutoLinkMask(Linkify.ALL); 
			holder.contents.setMovementMethod(LinkMovementMethod.getInstance());
			holder.contents.setOnClickListener(new View.OnClickListener() {

				@Override
				public void onClick(View v) {

					// ((AfterLandingActivity) getActivity()).jiazai(11);12
				}
			});
		} else {
			holder.contents.setOnClickListener(new View.OnClickListener() {
				@Override
				public void onClick(View v) {

				}
			});
		}
		if (user_trends.get(pos).getContents() != null) {

			String str = SinaExpressionTools
					.replaceAllPathToReplace(user_trends.get(pos).getContents()
							.toString());
			//
			int logs = str.length();
			if (logs > DongTaiZishu) {

				String ss = str.substring(0, DongTaiZishu);
				//
				String contentss = SinaExpressionTools
						.replaceAllReplaceToPath(ss);
				//
				new HtmlUtils(getActivity(), holder.contents, contentss)
						.showTextView();
				// holder.contents.setEllipsize(TruncateAt.END);
				// holder.contents.setMaxEms(DongTaiZishu);
				// holder.contents.setSingleLine(false);
				holder.xiangxi.setVisibility(View.VISIBLE);
				holder.xiangxi.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View v) {
						// 这是点击详细
						// User_trends_Model u = user_trends.get(pos);
						// String path = IOUtils
						// .getSavePinLunObjectPath(getActivity());
						// // 将序列化对象写入sdcard
						// 在AfterLandingDongTaiDiscussFragment中去
						// IOUtils.WriteSerializedObjectsToSDcard(path, (Object)
						// u);
						//
						// ((AfterLandingActivity) (getActivity())).jiazai(7);
						Intent intent = new Intent(getActivity(),
								LookAtTheDetailedActivity.class);
						intent.putExtra("User_trends_Model",
								user_trends.get(pos));
						intent.putExtra("ShowSuoQi", true);
						startActivity(intent);

					}
				});
			} else {
				new HtmlUtils(getActivity(), holder.contents, user_trends.get(
						pos).getContents()).showTextView();
				holder.xiangxi.setVisibility(View.GONE);
				holder.xiangxi.setOnClickListener(new View.OnClickListener() {
					@Override
					public void onClick(View v) {
						// 这是点击详细
					}
				});
			}
		}
		// 发表时间
		holder.addtime.setText(""
				+ CalendarTools.getTimeChangeToString(getActivity(),
						user_trends.get(pos).getAddtime()));
		// // 删除和举报按钮
		// holder.delete_hands
		// .setText("" + user_trends.get(pos).getDelete_hands());
		// 删除和举报
		if (user_trends.get(pos).getDelete_hands() != null) {
			drop(user_trends, pos, holder.drop_down);
		}
		// 获赞次数
		holder.admire.setText("" + user_trends.get(pos).getAdmire());
		// 评论次数
		holder.discuss.setText("" + user_trends.get(pos).getDiscuss());
		// 收藏次数
		holder.collect.setText("" + user_trends.get(pos).getCollect());
		// 分享次数
		holder.share.setText("" + user_trends.get(pos).getShare());

		// 点击赞
		holder.ll_admire.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {

				// 收费的
				if (!Utils.getUid(getActivity()).equals("")) {

				} else {
					Utils.showMessage(getActivity(),
							getResources().getString(R.string.l_xb10));
				}
			}
		});
		// 点击评论
		holder.ll_discuss.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (!Utils.getUid(getActivity()).equals("")) {
					User_trends_Model u = user_trends.get(pos);
					u.setClub_id(cid);
					// String path =
					// IOUtils.getSavePinLunObjectPath(getActivity());
					// // 将序列化对象写入sdcard 在AfterLandingDongTaiDiscussFragment中去
					// IOUtils.WriteSerializedObjectsToSDcard(path, (Object) u);
					//
					// ((AfterLandingActivity) (getActivity())).jiazai(13);
					Intent intent = new Intent(getActivity(),
							LookAtTheDetailedActivity.class);
					intent.putExtra("User_trends_Model", u);
					startActivity(intent);
				} else {
					Utils.showMessage(getActivity(),
							getResources().getString(R.string.l_xb10));
				}
			}
		});
		if (flags == POST_COLLECT) {
			user_trends.get(pos).setIs_collected(1);
		}
		// 是否收藏
		if (user_trends.get(pos).getIs_collected() == 1) {
			holder.is_collected.setSelected(true);
			holder.is_collected.setOnClickListener(new View.OnClickListener() {

				@Override
				public void onClick(View v) {
					if (!Utils.getUid(getActivity()).equals("")) {

					} else {
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.l_xb10));
					}

				}
			});
		} else {
			holder.is_collected.setSelected(false);
			holder.is_collected.setOnClickListener(new View.OnClickListener() {

				@Override
				public void onClick(View v) {
					if (!Utils.getUid(getActivity()).equals("")) {
						pos_ = pos;
						//
						// + user_trends.get(pos).getId() + "/"
						// + user_trends.get(pos).getType());
						if (club_type.equals("1")) {
							collect(cid, user_trends.get(pos).getUid(),
									user_trends.get(pos).getId(), user_trends
											.get(pos).getType());
						} else {
							Utils.showMessage(getActivity(), getResources()
									.getString(R.string.wx_txt_107));
						}
					} else {
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.l_xb10));
					}
				}
			});
		}
		// 分享
		holder.ll_share.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				if (!Utils.getUid(getActivity()).equals("")) {
					String xinqingtupians = user_trends.get(pos)
							.getTrends_img();
					String[] xinqingtupian = xinqingtupians.split(",");
					ShareImage = xinqingtupian[0];

					if (!StringUtil.isNullOrEmpty(ShareImage)) {
						ShareSDKTools.ShowOneKeyShare(getActivity(), "分享",
								user_trends.get(pos).getContents(), "",
								Constants.BadiDownImgUrl + "/" + ShareImage
										+ Constants.appPhoto4img,
								"humor_trends", user_trends.get(pos).getId(),
								user_trends.get(pos).getUid(), cid,
								"humor_trends");
					} else {
						ShareSDKTools.ShowOneKeyShare(getActivity(), "分享",
								user_trends.get(pos).getContents(), "", "",
								"humor_trends", user_trends.get(pos).getId(),
								user_trends.get(pos).getUid(), cid,
								"humor_trends");
					}

					ShareSDKTools
							.setOnShareFinishCallBack(new ShareSDKTools.CallBack() {

								@Override
								public void ShareFinishCallBack() {
									// TODO Auto-generated method stub
									int a = Integer.parseInt(user_trends.get(
											pos).getShare());
									user_trends.get(pos).setShare("" + (a + 1));

									try {
										x1Adapter.notifyDataSetChanged();

									} catch (Exception e) {
										// TODO: handle exception
									}

								}
							});
				} else {
					Utils.showMessage(getActivity(),
							getResources().getString(R.string.l_xb10));
				}
			}
		});
		// 地址
		holder.xinqingaddress.setVisibility(View.VISIBLE);
		if (user_trends.get(pos).getAddress() != null) {
			holder.xinqingaddress.setText(""
					+ user_trends.get(pos).getAddress());
			holder.xinqingaddress.setVisibility(View.VISIBLE);
		} else {
			holder.xinqingaddress.setVisibility(View.GONE);
		}
	}

	// TODO Auto-generated method stub
	/**
	 * 初始化活动id
	 * 
	 * @param convertView
	 * @param holder
	 */
	public void initActivityId(View convertView, ViewHolder holder) {
		holder.drop_down = (ImageView) convertView.findViewById(R.id.drop_down);
		/**
		 * 是否已经赞过了
		 */
		holder.is_praise = (ImageView) convertView.findViewById(R.id.is_praise);
		// 头像
		holder.head = (ImageView) convertView.findViewById(R.id.head);
		// 昵称
		holder.nickName = (TextView) convertView.findViewById(R.id.nickName);
		// 昵称
		holder.time = (TextView) convertView.findViewById(R.id.time);
		// 活动名称
		holder.names = (TextView) convertView.findViewById(R.id.names);
		// 活动开始时间和结束时间
		holder.start_timeaddend_time = (TextView) convertView
				.findViewById(R.id.start_timeaddend_time);
		// // 删除和举报按钮
		// holder.delete_hands = (Button) convertView
		// .findViewById(R.id.delete_hands);
		// 地点
		holder.address = (TextView) convertView.findViewById(R.id.address);
		// 活动类型
		holder.typeid = (TextView) convertView.findViewById(R.id.typeid);
		// 获赞次数
		holder.admire = (TextView) convertView.findViewById(R.id.admire);
		// 评论次数
		holder.discuss = (TextView) convertView.findViewById(R.id.discuss);
		// 收藏次数
		holder.collect = (TextView) convertView.findViewById(R.id.collect);
		// 分享次数
		holder.share = (TextView) convertView.findViewById(R.id.share);
		holder.image = (ImageView) convertView.findViewById(R.id.image);

		//
		holder.ll_admire = (LinearLayout) convertView
				.findViewById(R.id.ll_admire);
		holder.ll_discuss = (LinearLayout) convertView
				.findViewById(R.id.ll_discuss);
		holder.ll_collect = (LinearLayout) convertView
				.findViewById(R.id.ll_collect);
		holder.ll_share = (LinearLayout) convertView
				.findViewById(R.id.ll_share);
		holder.ll_link = (LinearLayout) convertView.findViewById(R.id.ll_link);

	};

	/**
	 * 显示 发活动动态
	 * 
	 * @param convertView
	 * @param holder
	 * @param pos
	 */
	public void PostActivityDongtai(View convertView, final ViewHolder holder,
			final int pos) {
		holder.ll_link.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intent = new Intent(getActivity(),
						ActivityReadingActivity.class);
				intent.putExtra("actId", user_trends.get(pos).getId());

				// 地点
				if (user_trends.get(pos).getIs_online().equals("0")) {
					intent.putExtra("isOnLine", false);
				} else {
					intent.putExtra("isOnLine", true);
					// holder.address.setText("线上主题");//
					// getActivity().getResources().getString(R.string.OnlineTheme)
				}

				startActivity(intent);
			}
		});
		// 是否已经赞过
		if (user_trends.get(pos).getIs_praise().equals("1")) {
			holder.is_praise.setSelected(true);
			holder.is_praise.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					if (!Utils.getUid(getActivity()).equals("")) {
					} else {
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.l_xb10));
					}
				}
			});

		} else // 0未赞
		{
			holder.is_praise.setSelected(false);
			holder.is_praise.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					if (!Utils.getUid(getActivity()).equals("")) {
						change_view = holder.is_praise;
						dianzan(getActivity(), Utils.getUid(getActivity()),
								user_trends.get(pos).getId(),
								user_trends.get(pos).getUid(),
								user_trends.get(pos).getType(), pos);
					} else {
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.l_xb10));
					}
				}
			});
		}
		// 头像
		try {
			ImageLoader.getInstance().displayImage(
					Constants.BadiDownImgUrl + "/"
							+ user_trends.get(pos).getHead()
							+ Constants.appPhoto4img, holder.head, options);
		} catch (Exception e) {

		}
		holder.head.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (!StringUtil.isNullOrEmpty(user_trends.get(pos).getUid())) {
					if (user_trends.get(pos).getUid()
							.equals("" + Utils.getUid(getActivity()))) {
						// ((AfterLandingActivity) (getActivity())).jiazai(9);
						Intent intent = new Intent(getActivity(),
								MyDataActivity.class);
						// intent.putExtra("isStartTwoClose", true);
						startActivity(intent);

					} else {
						Intent intent = new Intent(getActivity(),
								SeeOtherPeopleSpaceActivity.class);
						intent.putExtra("friend_id", user_trends.get(pos)
								.getUid());

						startActivity(intent);
					}
				}

			}
		});
		// 昵称
		holder.nickName.setText("" + user_trends.get(pos).getNickName());
		holder.nickName.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (!StringUtil.isNullOrEmpty(user_trends.get(pos).getUid())) {
					if (user_trends.get(pos).getUid()
							.equals("" + Utils.getUid(getActivity()))) {
						// ((AfterLandingActivity) (getActivity())).jiazai(9);
						Intent intent = new Intent(getActivity(),
								MyDataActivity.class);
						// intent.putExtra("isStartTwoClose", true);
						startActivity(intent);

					} else {
						Intent intent = new Intent(getActivity(),
								SeeOtherPeopleSpaceActivity.class);
						intent.putExtra("friend_id", user_trends.get(pos)
								.getUid());

						startActivity(intent);
					}
				}

			}
		});
		// 时间
		holder.time.setText(""
				+ CalendarTools.getTimeChangeToString(getActivity(),
						user_trends.get(pos).getTime()));

		// 活动名称
		holder.names.setText("" + user_trends.get(pos).getNames());
		// 活动开始时间和结束时间
		holder.start_timeaddend_time.setText(""
				+ Utils.Back_Data(user_trends.get(pos).getStart_time()) + "-"
				+ Utils.Back_Data(user_trends.get(pos).getEnd_time()));
		// // 删除和举报按钮
		// holder.delete_hands
		// .setText("" + user_trends.get(pos).getDelete_hands());
		// 删除和举报
		if (user_trends.get(pos).getDelete_hands() != null) {
			drop(user_trends, pos, holder.drop_down);
		}
		//
		if (user_trends.get(pos).getIs_online() != null) {
			// 地点
			if (user_trends.get(pos).getIs_online().equals("0")) {
				holder.address.setText("" + user_trends.get(pos).getAddress());
			} else {
				holder.address.setText(getResources().getString(
						R.string.wx_up_zhuti));// getActivity().getResources().getString(R.string.OnlineTheme)
			}
		}
		// 活动类型
		holder.typeid.setText("" + user_trends.get(pos).getTypeid().getName());
		// 获赞次数
		holder.admire.setText("" + user_trends.get(pos).getAdmire());
		// 评论次数
		holder.discuss.setText("" + user_trends.get(pos).getDiscuss());
		// 收藏次数
		holder.collect.setText("" + user_trends.get(pos).getCollect());
		// 分享次数
		holder.share.setText("" + user_trends.get(pos).getShare());
		try {
			ImageLoader.getInstance().displayImage(
					Constants.BadiDownImgUrl + "/"
							+ user_trends.get(pos).getImage()
							+ Constants.App9block, holder.image, options);
		} catch (Exception e) {

		}
		// 点击赞
		holder.ll_admire.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {

				// 收费的
				if (!Utils.getUid(getActivity()).equals("")) {
				} else {
					Utils.showMessage(getActivity(),
							getResources().getString(R.string.l_xb10));
				}
			}
		});
		// 点击评论
		holder.ll_discuss.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				if (!Utils.getUid(getActivity()).equals("")) {

					User_trends_Model u = user_trends.get(pos);
					u.setClub_id(cid);
					// String path =
					// IOUtils.getSavePinLunObjectPath(getActivity());
					// // 将序列化对象写入sdcard 在AfterLandingDongTaiDiscussFragment中去
					// IOUtils.WriteSerializedObjectsToSDcard(path, (Object) u);
					//
					// ((AfterLandingActivity) (getActivity())).jiazai(13);
					Intent intent = new Intent(getActivity(),
							LookAtTheDetailedActivity.class);
					intent.putExtra("User_trends_Model", u);
					startActivity(intent);
				} else {
					Utils.showMessage(getActivity(),
							getResources().getString(R.string.l_xb10));
				}
			}
		});
		// 点击收藏
		holder.ll_collect.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				if (!Utils.getUid(getActivity()).equals("")) {
				} else {
					Utils.showMessage(getActivity(),
							getResources().getString(R.string.l_xb10));
				}
			}
		});
		// 分享
		holder.ll_share.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				if (!Utils.getUid(getActivity()).equals("")) {
					if (!StringUtil.isNullOrEmpty(user_trends.get(pos)
							.getImage())) {
						ShareSDKTools.ShowOneKeyShare(getActivity(), "分享",
								user_trends.get(pos).getNames(), "",
								Constants.BadiDownImgUrl + "/"
										+ user_trends.get(pos).getImage()
										+ Constants.appPhoto4img, "activity",
								user_trends.get(pos).getId(),
								user_trends.get(pos).getUid(), cid, "activity");
					} else {
						ShareSDKTools.ShowOneKeyShare(getActivity(), "分享",
								user_trends.get(pos).getNames(), "", "",
								"activity", user_trends.get(pos).getId(),
								user_trends.get(pos).getUid(), cid, "activity");
					}

					ShareSDKTools
							.setOnShareFinishCallBack(new ShareSDKTools.CallBack() {

								@Override
								public void ShareFinishCallBack() {
									// TODO Auto-generated method stub
									int a = Integer.parseInt(user_trends.get(
											pos).getShare());
									user_trends.get(pos).setShare("" + (a + 1));

									try {
										x1Adapter.notifyDataSetChanged();

									} catch (Exception e) {
										// TODO: handle exception
									}

								}
							});
				} else {
					Utils.showMessage(getActivity(),
							getResources().getString(R.string.l_xb10));
				}
			}
		});
		//

	}

	/**
	 * 点赞 接口名称 praise_operate 用户的点赞人的id 提交方式$GET
	 * 
	 * @param $uid
	 *            ;//点赞人的id
	 * @param $nid
	 *            ;//被操作内容的Id
	 * @param $nuid
	 *            ;//内容所属人id
	 * @param $type赞的类型
	 *            （record_article，club，humor_trends，photo，activity）
	 * @param hander
	 *            ;
	 * @param Success
	 *            ;成功
	 * @param defalt
	 *            ;失败
	 */
	public void dianzan(final Context context, final String uid,
			final String nid, final String nuid, final String type,
			final int pos) {
		Utils.showPrgress(context);
		new Thread(new Runnable() {

			@Override
			public void run() {
				String content = Utils.getRequest(Constants.BadiUrl
						+ "praise_operate?uid=" + uid + "&nid=" + nid
						+ "&nuid=" + nuid + "&type=" + type);
				//
				// + "type=" + type);
				// ("数据是：" + content);
				if (content != null) {
					// ("数据是：" + content);
					Results results = Utils.checkResult_NNN(context, content);
					if (results != null && !results.getRetmsg().equals("null")) {
						//
						try {

							if (results.isRet()) {
								Message msg = new Message();
								msg.what = 5;
								Bundle bun = new Bundle();
								bun.putInt("pos", pos);
								msg.setData(bun);
								handler.sendMessage(msg);
							} else
								handler.sendEmptyMessage(6);
						} catch (Exception e) {

						}
					} else {
						handler.sendEmptyMessage(1);
					}
				} else {
					handler.sendEmptyMessage(1);
				}
			}
		}).start();

	}

	// ///////
	static class ViewHolder {

		public TextView pictureNum;
		public ImageView drop_down;// 下拉的
		public TextView xinqingaddress;
		public LinearLayout l_blue2;
		public LinearLayout l_blue1;
		public LinearLayout ll_link;
		public ImageView is_collected;
		// 顶部视图
		TextView top_text_gongneng, top_text_mail;// 一个是功能按钮，一个是管理员的按钮
		ImageView top_gongnengpic;// 功能图
		LinearLayout btn_zhuanrang, btn_zhannei;// 一个是功能按钮，一个是管理员的按钮

		// one
		public LinearLayout ll_home_page;// 个人主页
		public LinearLayout ll_picture;// 照片
		public LinearLayout ll_record;// 记录
		// public LinearLayout ll_club;// 俱乐部
		public LinearLayout ll_activity;// 活动
		public LinearLayout ll_consult;// 咨询

		// two
		public LinearLayout ll_shenqingbiao;// 申请表
		public LinearLayout ll_collect;// 收藏
		public LinearLayout ll_members;// 会员
		public LinearLayout ll_data;// 资料
		// public LinearLayout ll_otherspace;// 其他空间

		public ImageView left;
		public ImageView right;
		public LinearLayout two_line;
		public LinearLayout two;
		public LinearLayout one_line;
		public LinearLayout one;
		public TextView t_friends;
		public TextView t_activity;
		public TextView t_club;
		public TextView t_record;
		public TextView t_picture;
		public TextView tv_city;
		public TextView tv_nickName;
		public TextView tv_motto;
		public ImageView iv_touxiang;
		public ImageView iv_beijing;

		public TextView photoImgNum_text;
		public TextView activityNum_text;
		public TextView recordNum_text;
		public TextView addnum_text;
		public TextView shenqingbiao_text;
		public TextView consult_text;

		// 'record' 对应的属性
		// public String type;//类型 用于判断接收返回值是选用的model
		public TextView view;// 浏览次数
		// public String discuss;//评论次数
		// public String collect;//收藏次数
		// public String id;//该记录的id
		// public String time;//记录添加时间
		public ImageView image;// 封面图
		public TextView content;// 记录的内容
		// public String delete_hands;//自己 为删除 别的人 举报
		// public String nickName;//发表信息用户昵称
		// private String head//发表信息用户头像
		// private String uid//发表信息的用户id

		// 'photo' 对应的属性（相册）

		// public String type;//类型 用于判断接收返回值是选用的model
		public TextView time;// 上传时间
		public TextView comment;// 评论
		public TextView reprint;// 获赞
		public TextView img;// 上传的照片路劲和id
		public TextView z_user;// 点赞的人名称和id
		public TextView img_count;// 上传照片的数量
		public TextView photo_name;// 上传到到哪个相册名称
		// public String delete_hands;//自己 为删除 别的人 举报
		// public String nickName;//发表信息用户昵称
		// private String head//发表信息用户头像
		// private String uid//发表信息的用户id
		// public ImageView iv_0;
		// public ImageView iv_1;
		// public ImageView iv_2;
		// public ImageView iv_3;
		// public ImageView iv_4;
		// public ImageView iv_5;
		// public ImageView iv_6;
		// public ImageView iv_7;
		// public ImageView iv_8;
		public LinearLayout l_width;
		public ImageView is_praise;// 是否已赞

		// public GridView gv_xinqingpicture;

		// 'humor_trends'心情动态类型
		private String id;// 动态id
		// public String admire;//获赞次数
		// public String discuss;//评论次数
		public TextView collect;// 收藏次数
		public TextView share;// 分享次数
		public String trends_img;// 心情图片路径，多张图片路径用逗号分隔开
		public TextView contents;// 内容
		public String img_url;// 图片网址
		public String video_url;// 视频网址
		public String word_url;// 文字网址
		public TextView addtime;// 发表时间
		// public String delete_hands;//自己 为删除 别的人 举报
		// public String nickName;//发表信息用户昵称
		// public String head;//发表信息用户头像
		// public String uid;//发表信息的用户id
		// public String is_praise;//是否已赞
		public GridView gv_xinqingpicture;// 显示要上传的图片

		// 'activity' 对应的属性（活动）
		public String type;// 类型 用于判断接收返回值是选用的model
		// public String uid;//用户Id
		public TextView start_time;// 开始时间//
		public TextView end_time;// 结束时间

		public TextView start_timeaddend_time;
		public TextView names;// 活动名字
		public TextView typeid;// 活动类型
		public String introduce;// 活动内容简介
		public String gold;// 参加活动所需金额
		public String applied;// 已报名数
		public TextView discuss;// 评论
		public TextView admire;// 赞
		// public String nickName;//用户昵称
		// public String head;//用户头像
		// public String uid;//发表信息的用户id
		// public String delete_hands;//自己 为删除 别的人 举
		public String is_online;// 线上或线下（0：线下，1：线上）
		public TextView address;// 只有活动为线下时 才有此值
		// public String time;//写这条动态的时间
		// private String collect;//收藏次数
		// private String share;//分享次数
		// private String image;//活动代表图
		// 分别是四个 赞，评论，分享，收藏
		public LinearLayout ll_admire, ll_discuss, ll_share;// ll_collect,
		// public String is_praise;//是否已赞
		// 'club' 对应的属性 （俱乐部）

		private TextView nickName;// 用户昵称
		private ImageView head;// 用户头像
		private String uid;// 发表信息的用户id
		private String cid;// 俱乐部id
		private TextView name;// 俱乐部名称
		private ImageView logo;// 俱乐部logo
		private TextView originate_address;// 俱乐部地址
		private TextView price;// 俱乐部加入所需金币
		private Button delete_hands;// 自己 为删除 别的人 举报
		// private String time;
		// private String discuss; //评论
		// private String admire; //赞
		// private String collect; //收藏
		// private String share; //分享
		public TextView typeName;// 俱乐部类型
		public TextView xiangxi;
		// public String is_praise;//是否已赞

		// public LinearLayout ll_admire,ll_dicuss,ll_share;//ll_collect,
		// 下面是俱乐部
		// public String uid;
		public String recordNum;
		// public String logo;
		public String activityNum;
		public String room_limit;// 空间权限
		// public String name//": "登山俱乐部",
		public String photoImgNum;
		// public String originate_address;//发源地
		public String addnum;// 会员数量
		public String consultnum;// 咨询数量
		public String room_head;// 俱乐部空间头像
		public String info;// 信息

		private ImageView videoimage;
		private TextView videotitle;
		public LinearLayout videoxianshi;
	}

	/**
	 * 俱乐部主页----post
	 * 
	 * @param $cid
	 *            //俱乐部ID---11
	 * @param $uid
	 *            //访客用户的ID----1(管理员) 8（该俱乐部普通会员） 26（未加入该俱乐部用户）
	 * @param $type
	 *            ;//查看类型（1:管理员，2：该俱乐部普通会员，3：未加入该俱乐部用户）
	 * @param $languageType
	 *            ;//name为中文简体，tw_name 中文繁体 en_name 英文
	 * @param $page
	 *            ;//第几页
	 * @param $pageNum
	 *            ;//每页显示条数
	 * 
	 * 
	 *            俱乐部收藏内容显示接口
	 * @param $cid
	 *            ;//俱乐部id
	 * @param $uid
	 *            ;//查看者 id
	 * @param $page
	 *            ;//第几页
	 * @param $pageNum
	 *            ;//每页显示的条数
	 */
	// 和俱乐部主页动态用的model是一样的
	private void addData(final String cid, final String uid, final String type,
			final String languageType, final String pageNum) {
		MyThreadTool.fixedThreadPool.execute(new Runnable() {
			@Override
			public void run() {
				list = new ArrayList<User_trends_Model>();
				personalCenterHomePageModel = new PersonalCenterHomePageModel();
				//
				// + "languageType=" + languageType + "page=" + page
				// + "pageNum=" + pageNum);
				Map<String, Object> map = new HashMap<String, Object>();

				if (flags != POST_COLLECT) {
					map.put("type", type);
					map.put("languageType", languageType);
				}
				map.put("cid", cid);
				map.put("uid", uid);
				map.put("page", page);
				map.put("pageNum", pageNum);
				// (map.toString());
				String content = null;
				// if (flags == POST_PERSONAL_CENTE_HOME_PAGE)
				if (flags == POST_COLLECT) {
					content = Utils.sendRequest(map, Constants.BadiUrl_1
							+ "club/collect");
					System.out.println("club" + content);
				} else {
					content = Utils.sendRequest(map, Constants.BadiUrl_1
							+ "club/clubIndex");
					System.out.println("clubaaa" + content);
				}

				// else if (flags == POST_COLLECT)
				// content = Utils.sendRequest(map, Constants.BadiUrl
				// + "collect");
				if (content != null) {
					Results results = Utils.checkResult_NNN(getActivity(),
							content);
					// ("俱乐部数据返回信息是:" + content);
					if (results != null && !results.getRetmsg().equals("null")) {
						try {

							//
							if (flags == POST_PERSONAL_CENTE_HOME_PAGE) {
								personalCenterHomePageModel = JSONUtils.getEntityByJsonString(
										results.getRetmsg(),
										PersonalCenterHomePageModel.class);
								System.out.println("julebu"
										+ results.getRetmsg());
							} else if (flags == POST_COLLECT) {
								// list = JSONUtils.getListByJsonString(
								// results.getRetmsg(),
								// User_trends_Model.class);
								personalCenterHomePageModel = JSONUtils.getEntityByJsonString(
										results.getRetmsg(),
										PersonalCenterHomePageModel.class);
							}
							if (personalCenterHomePageModel2 == null) {
								personalCenterHomePageModel2 = personalCenterHomePageModel;
								admin_id = personalCenterHomePageModel2
										.getUid();
							}
							handler.sendEmptyMessage(2);
						} catch (Exception e) {

							handler.sendEmptyMessage(2);
						}
					} else {
						if (page > 1) {
							--page;
						} else {
							page = 1;
						}
						handler.sendEmptyMessage(3);
					}
				} else {
					if (page > 1) {
						--page;
					} else {
						page = 1;
					}
					handler.sendEmptyMessage(1);
				}
			}
		});
	}

	private void Add_club(final String is_apply, final String content) {
		Utils.showPrgress(getActivity());
		MyThreadTool.fixedThreadPool.execute(new Runnable() {
			@Override
			public void run() {
				Map<String, Object> map = new HashMap<String, Object>();
				map.put("uid", Utils.getUid(getActivity()));
				map.put("cid", cid);
				map.put("is_apply", is_apply);
				if (is_apply.equals("1")) {
					map.put("contents", content);
				}
				String content = Utils.sendRequest(map, Constants.BadiUrl_1
						+ "club/attendClub");
				if (content != null) {
					resultsdd = Utils.checkResult_NNN(getActivity(), content);
					// ("加入俱乐部返回的参数是:" + content + " "
					// + resultsdd.getRetmsg());
					if (resultsdd != null
							&& !resultsdd.getRetmsg().equals("null")) {

						handler.sendEmptyMessage(8);
					} else {
						// handler.sendEmptyMessage(17);
					}
				} else {
					handler.sendEmptyMessage(7);
				}
			}
		});
	}

	/**
	 * 用户+俱乐部 收藏的操作接口 提交方式GET
	 * 
	 * @param $uid
	 *            ;//收藏人的id
	 * @param $cid
	 *            ;//俱乐部收藏-------仅有record，humor_trends 这两种收藏方式，当为个人收藏时，值为0
	 * @param $nuid
	 *            ;//被收藏内容所属的用户id
	 * @param $nid
	 *            ;//被收藏的内容id
	 * @param $type
	 *            ;//被收藏的类型-----个人（3种）：photo_img，record，humor_trends
	 *            俱乐部（2种）：record，humor_trends
	 */
	public void collect(String cid, String nuid, String neirong_id, String type) {// Constants.BadiUrl+
																					// "praise_operate?uid="+uid+"&nid="+nid+"&nuid="+nuid+"&type="+type
		/*
		 * 用户收藏的操作接口 提交方式GET
		 * 
		 * @param $uid;//收藏人的id @param $nuid;//被收藏内容所属的用户id
		 * 
		 * @param $nid;//被收藏的内容id @param
		 * $type;//被收藏的类型（photo_img，record，humor_trends）
		 */
		String uid = Utils.getUid(getActivity());
		Utils.showPrgress(getActivity());
		CommonUtils.CommomGetfunction(getActivity(), Constants.BadiUrl
				+ "collect_operate?uid=" + uid + "&cid=" + cid + "&nuid="
				+ nuid + "&nid=" + neirong_id + "&type=" + type, handler, 1, 1,
				11, 12);
		// LogUtils.v("收藏提交的数据是"+Constants.BadiUrl
		// + "collect_operate?uid=" + uid + "&cid=" + cid + "&nuid="
		// + nuid + "&nid=" + neirong_id + "&type=" + type);
	}

	/**
	 * 删除动态 动态的id
	 */
	public void deleteDongTai(String id) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("uid", Utils.getUid(getActivity()));
		map.put("trendsId", id);
		CommonUtils.CommomPostfunction(getActivity(), Constants.BadiUrl_1
				+ "commonality/deleteTrends", map, handler, 1, 9, 13, 14);
	}

	/**
	 * 举报 被举报人的id 举报类行
	 * 
	 * @param bei_person_id
	 *            被举报人id
	 * @param table
	 *            举报类型humor_trends：心情动态，photo：相册，record：记录（篇），record_article：记录（
	 *            记），activity：活动，club：俱乐部，discuss：评论
	 * @param bei_neirong_id
	 *            举报的内容id
	 */
	public void jubao(String bei_person_id, String table, String bei_neirong_id) {
		Intent intent = new Intent(getActivity(), InformActivity.class);
		intent.putExtra("bei_person_id", bei_person_id);
		intent.putExtra("table", table);
		intent.putExtra("bei_neirong_id", bei_neirong_id);
		intent.putExtra("bei_cid", "0");
		startActivity(intent);
	}

	@Override
	public void onRefresh() {
		// addData(page, null);
		user_trends = new ArrayList<User_trends_Model>();
		page = 1;
		user_trends.add(new User_trends_Model());
		personalCenterHomePageModel2 = null;
		addData(cid, club_uid, club_type,
				Dialog.getSystemLanguageTypegrzx(getActivity()), "" + pageNum);

	}

	@Override
	public void onLoadMore() {
		//

		page = page + 1;

		addData(cid, club_uid, club_type,
				Dialog.getSystemLanguageTypegrzx(getActivity()), "" + pageNum);
	}

	public String getClub_type() {
		return club_type;
	}

	public void setClub_type(String club_type) {
		this.club_type = club_type;
	}

	public void getPersonalCenterHomePageModel(Callback callback) {
		callback.getPersonalCenterHomePageModel2(personalCenterHomePageModel2);
	}

	// personalCenterHomePageModel2
	public interface Callback {
		void getPersonalCenterHomePageModel2(PersonalCenterHomePageModel per);
	}

	// personalCenterHomePageModel2
	public void drop(final List<User_trends_Model> user_trends, final int pos,
			ImageView drop) {

		LayoutInflater inflater = LayoutInflater.from(getActivity());
		View root = inflater.inflate(R.layout.drop_down, null);

		TextView delete_hands = (TextView) root.findViewById(R.id.delete_hands);

		if (user_trends.get(pos).getDelete_hands() != null) {
			if (user_trends.get(pos).getDelete_hands().equals("删除")) {
				// LogUtils.d("Delete_hands="
				// + user_trends.get(pos).getDelete_hands());
				user_trends.get(pos).setDelete_hands(
						getActivity().getString(R.string.Delete));
			} else if (user_trends.get(pos).getDelete_hands().equals("举报")) {
				// LogUtils.d("Delete_hands="
				// + user_trends.get(pos).getDelete_hands());
				user_trends.get(pos).setDelete_hands(
						getActivity().getString(R.string.Inform));
			}
		}

		delete_hands.setText("" + user_trends.get(pos).getDelete_hands());
		if (user_trends.get(pos).getDelete_hands()
				.equals(getResources().getString(R.string.wx_delete))) {
			delete_hands.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					if (!Utils.getUid(getActivity()).equals("")) {
						Dialog dialog = new Dialog();
						dialog.CreateDialog(getActivity(), getResources()
								.getString(R.string.wx_txt_55), getResources()
								.getString(R.string.wx_txt_56));
						dialog.setOnDialogClistener(new Dialog.DialogClistener() {

							@Override
							public void ret() {
								// TODO Auto-generated method stub

							}

							@Override
							public void ok() {
								// TODO Auto-generated method stub
								delete_where_dongtai = pos;
								deleteDongTai(user_trends.get(pos)
										.getTrendsId());
							}
						});
					} else {
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.l_xb10));
					}
				}
			});
		} else {
			delete_hands.setOnClickListener(new View.OnClickListener() {

				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					if (!Utils.getUid(getActivity()).equals("")) {
						jubao(user_trends.get(pos).getUid(),
								user_trends.get(pos).getType(), user_trends
										.get(pos).getId());
						// 就是举报
					} else {
						Utils.showMessage(getActivity(), getResources()
								.getString(R.string.l_xb10));
					}

				}
			});
		}

		PopWindowUtils.showPopWindow(getActivity(), root, drop);

	}

	/**
	 * 一个popWindow
	 */
	public void settingJoinPopWindow() {// address
		DisplayMetrics dm = new DisplayMetrics();
		Display d = getActivity().getWindowManager().getDefaultDisplay();
		d.getMetrics(dm);
		int width = dm.widthPixels; // 得到宽度
		int height = dm.heightPixels; // 得到高度
		LayoutInflater inflater = (LayoutInflater) getActivity()
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

		View view = inflater.inflate(R.layout.activity_club_reading_popwindows,
				null);

		if (dataModel != null) {
			TextView startTimeAddEndTime = (TextView) view
					.findViewById(R.id.startTimeAddEndTime);

			startTimeAddEndTime.setText(Utils.Get_Data(
					dataModel.getCreatetime(), "yyyy-MM-dd HH:mm", "000"));
			// 地址
			if (dataModel.getOriginate_address() != null) {
				TextView address = (TextView) view.findViewById(R.id.address);

				address.setText(dataModel.getOriginate_address());

			}
			// 活动名称
			if (dataModel.getName() != null) {
				TextView names = (TextView) view.findViewById(R.id.names);
				names.setText(dataModel.getName());
			}
			// 种类
			if (dataModel.getTypeName() != null) {
				TextView type = (TextView) view.findViewById(R.id.type);
				type.setText(dataModel.getTypeName());
			}
			// 参加活动所需金币
			if (dataModel.getPrice() != null) {
				TextView gold = (TextView) view.findViewById(R.id.gold);
				gold.setText(dataModel.getPrice());
			}
			// 已经参加的人数
			if (personalCenterHomePageModel2.getAddnum() != null) {
				TextView Joinnum = (TextView) view.findViewById(R.id.Joinnum);
				Joinnum.setText(personalCenterHomePageModel2.getAddnum());
			}
			// 确定参加俱乐部
			view.findViewById(R.id.ok).setOnClickListener(
					new View.OnClickListener() {

						@Override
						public void onClick(View v) {
							Dialog dialog = new Dialog();
							dialog.CreateDialog(
									getActivity(),
									getResources().getString(
											R.string.l_xb184),
									getResources().getString(
											R.string.l_xb185)
											+ dataModel.getPrice()
											+ getResources().getString(
													R.string.l_xb16));
							dialog.setOnDialogClistener(new Dialog.DialogClistener() {

								@Override
								public void ret() {

								}

								@Override
								public void ok() {
									if (!Utils.getUid(getActivity()).equals("")) {
										if (personalCenterHomePageModel2.getIs_person()
												.equals("0")) {

											if (!StringUtil
													.isNullOrEmpty(personalCenterHomePageModel2
															.getIs_gold())) {
												if (personalCenterHomePageModel2
														.getIs_gold().equals("1")) {
													if (Integer
															.valueOf(personalCenterHomePageModel2
																	.getPrice()) <= Integer
															.valueOf(personalCenterHomePageModel2
																	.getGold())) {
														if (personalCenterHomePageModel2
																.getIs_apply().equals(
																		"0")) {
															Add_club("0", "");
														} else {
															Intent intent = new Intent(
																	getActivity(),
																	AddApplyFormActivity.class);
															intent.putExtra("pan",
																	"set");
															intent.putExtra("cid", cid);
															intent.putExtra(
																	"apply_id",
																	personalCenterHomePageModel2
																			.getApplyTableId());
															startActivity(intent);
															// Add_club("1",);
														}
													} else {
														Utils.showMessage(
																getActivity(),
																getResources()
																		.getString(
																				R.string.wx_txt_111));
													}
												} else {
													if (personalCenterHomePageModel2
															.getIs_apply().equals("0")) {
														Add_club("0", "");
													} else {
														Intent intent = new Intent(
																getActivity(),
																AddApplyFormActivity.class);
														intent.putExtra("pan", "set");
														intent.putExtra("cid", cid);
														intent.putExtra(
																"apply_id",
																personalCenterHomePageModel2
																		.getApplyTableId());
														startActivity(intent);
														// Add_club("1",);
													}
												}

											}

										} else if (personalCenterHomePageModel2
												.getIs_person().equals("1")) {
											if (Integer
													.valueOf(personalCenterHomePageModel2
															.getAddnum()) >= Integer
													.valueOf(personalCenterHomePageModel2
															.getLimitnum())) {// 已达到人数限制
												Utils.showMessage(
														getActivity(),
														getResources().getString(
																R.string.wx_txt_110));
											} else {// 没有达到人数限制
												if (Integer
														.valueOf(personalCenterHomePageModel2
																.getPrice()) <= Integer
														.valueOf(personalCenterHomePageModel2
																.getGold())) {
													if (personalCenterHomePageModel2
															.getIs_apply().equals("0")) {
														Add_club("0", "");
													} else {
														Intent intent = new Intent(
																getActivity(),
																AddApplyFormActivity.class);
														intent.putExtra("pan", "set");
														intent.putExtra("cid", cid);
														intent.putExtra(
																"apply_id",
																personalCenterHomePageModel2
																		.getApplyTableId());
														startActivity(intent);
														// Add_club("1",);
													}
												} else {
													Utils.showMessage(
															getActivity(),
															getResources()
																	.getString(
																			R.string.wx_txt_111));
												}
											}
										}
									} else {
										Toast.makeText(
												getActivity(),
												getResources().getString(
														R.string.l_xb10), 0).show();
									}


								}
							});
							pop.dismiss();

							
						}
					});

		}

		view.findViewById(R.id.Cancle).setOnClickListener(
				new OnClickListener() {

					@Override
					public void onClick(View v) {
						pop.dismiss();

					}
				});

		pop = new PopupWindow(view, width, (height) * 1 / 2);
		pop.setBackgroundDrawable(new BitmapDrawable());
		pop.setFocusable(true);
		pop.setTouchable(true);
		pop.setOutsideTouchable(true);
		pop.showAtLocation(getActivity().findViewById(R.id.my_xListView1),
				Gravity.BOTTOM, 0, 0);

	}

	/**
	 * 俱乐部资料页面---POST
	 * 
	 * @param $cid
	 *            //俱乐部ID
	 * @param $languageType
	 *            ;（必需）//name为中文简体，tw_name 中文繁体 en_name 英文
	 */
	protected void abum(final String cid) {
		Utils.showPrgress(getActivity());
		MyThreadTool.fixedThreadPool.execute(new Runnable() {
			@Override
			public void run() {
				Map<String, Object> map = new HashMap<String, Object>();
				map.put("cid", cid);
				map.put("languageType",
						Dialog.getSystemLanguageTypegrzx(getActivity()));
				String content = Utils.sendRequest(map, Constants.BadiUrl_1
						+ "club/abum");
				//
				if (content != null) {
					Results results = Utils.checkResult_NNN(getActivity(),
							content);
					//
					if (results != null && !results.getRetmsg().equals("null")) {
						//
						try {
							dataModel = JSONUtils.getEntityByJsonString(
									results.getRetmsg(), ClubDataModel.class);
							handler.sendEmptyMessage(2);
						} catch (Exception e) {

						}
					} else {
						handler.sendEmptyMessage(3);
					}
				} else {

					handler.sendEmptyMessage(1);
				}
			}
		});
	}

}
